Published 2 months ago

Mastering AWS IAM: A Guided Lab Exploration

Software Development
Mastering AWS IAM: A Guided Lab Exploration

Mastering AWS IAM: A Guided Lab Exploration

This lab provides a hands-on exploration of AWS Identity and Access Management (IAM), focusing on users, groups, and policies. We'll walk through a practical scenario, adding users to groups and verifying their inherited permissions. By the end, you'll understand how to manage user access and secure your AWS resources effectively.

Task 1: Exploring Pre-created IAM Users, Groups, and Policies

This section involves examining pre-configured IAM users and groups to understand their default settings and associated policies. We will analyze the permissions granted to these entities, forming a foundation for subsequent tasks.

Exploring Users

Three users—user-1, user-2, and user-3—were pre-created for this lab. Let's investigate user-1:

  • Zero Permissions Policies: Initially, user-1 lacks any explicit permissions policies. This means they cannot access any AWS services until added to a group or assigned specific policies.
  • No Group Membership: user-1 is not a member of any groups, further reinforcing their lack of initial permissions.
  • Console Password Assigned: A console password is assigned, allowing access to the AWS Management Console. However, without additional policies, this access is limited.
/uploads/image_a6f9da83ef.png /uploads/image_4f10ae065b.png /uploads/image_fa71c43788.png /uploads/image_e386543d2e.png

Exploring Groups

Three groups exist: EC2-Admin, EC2-Support, and S3-Support. Let's examine EC2-Support:

  • Managed Policy: The group utilizes the AmazonEC2ReadOnlyAccess managed policy.
  • Policy JSON: This policy, defined in JSON, grants read-only access to Amazon EC2, Elastic Load Balancing, EC2 Auto Scaling, and CloudWatch. It's ideal for support roles.
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:Describe*",
        "ec2:GetSecurityGroupsForVpc"
      ],
      "Resource": "*" 
    },
    {
      "Effect": "Allow",
      "Action": "elasticloadbalancing:Describe*",
      "Resource": "*" 
    },
    {
      "Effect": "Allow",
      "Action": [
        "cloudwatch:ListMetrics",
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:Describe*"
      ],
      "Resource": "*" 
    },
    {
      "Effect": "Allow",
      "Action": "autoscaling:Describe*",
      "Resource": "*" 
    }
  ]
}
/uploads/image_ccdb06a9b8.png /uploads/image_228fed464f.png

The S3-Support group similarly uses the AmazonS3ReadOnlyAccess policy, granting read-only access to S3 buckets.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:Get*",
        "s3:List*",
        "s3:Describe*",
        "s3-object-lambda:Get*",
        "s3-object-lambda:List*"
      ],
      "Resource": "*" 
    }
  ]
}
/uploads/image_1fd8e4887f.png

The EC2-Admin group has the EC2-Admin-Policy, allowing description, starting, and stopping of EC2 instances (with limitations based on instance type).

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Condition": {
        "ForAllValues:StringLikeIfExists": {
          "ec2:InstanceType": [
            "*.nano",
            "*.micro"
          ]
        }
      },
      "Action": [
        "ec2:Describe*",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": [
        "*" 
      ],
      "Effect": "Allow" 
    }
  ]
}
/uploads/image_7b6df19283.png

Task 2: Adding Users to Groups - A Real-World Scenario

This section simulates a real-world scenario where new employees are assigned roles based on their job functions. We'll add users to the appropriate groups, granting them the necessary permissions.

/uploads/image_1e2e129396.png

Adding user-1 to S3-Support

user-1, newly hired S3 support, needs read-only access to S3. Adding them to the S3-Support group achieves this.

/uploads/image_9d3dd024ce.png /uploads/image_0770e0b3e7.png /uploads/image_b82860c7bf.png

Adding user-2 to EC2-Support

Similarly, user-2 (EC2 support) is added to the EC2-Support group.

/uploads/image_15c765021b.png /uploads/image_3f16a458c1.png /uploads/image_e632414ff0.png

Adding user-3 to EC2-Admin

Finally, user-3, the EC2 administrator, is added to the EC2-Admin group.

/uploads/image_4793a8bd99.png /uploads/image_781d1c5e92.png /uploads/image_212fd442ef.png /uploads/image_f3ff774a38.png

Task 3: Testing User Permissions

Now, let's test the permissions of each user by signing in using their credentials and accessing various AWS services. This practical exercise validates the effectiveness of the IAM configuration.

Signing in as user-1

After signing in with user-1's credentials using the provided sign-in URL, we can observe their access:

  • S3 Access: user-1 can view S3 buckets, confirming the read-only access granted via the S3-Support group.
  • EC2 Access Denied: Attempts to access EC2 services result in an "Access Denied" error, correctly reflecting the lack of EC2 permissions.
/uploads/image_3ab14dbe8c.png /uploads/image_ba5ab3d3d5.png /uploads/image_f074d9ff09.png /uploads/image_ccb6455935.png /uploads/image_b294e23750.png

Signing in as user-2

Similar steps are followed for user-2. The results highlight their read-only EC2 access and lack of S3 access.

/uploads/image_afc211a485.png /uploads/image_80ae7d1648.png /uploads/image_3dd92bb2b9.png /uploads/image_77c168ba24.png /uploads/image_270fe4da35.png /uploads/image_57348fb013.png

Signing in as user-3

Finally, testing user-3 demonstrates their ability to manage EC2 instances, including starting and stopping them, as expected from their administrative role.

/uploads/image_a114f52b3e.png /uploads/image_05e6723bd4.png /uploads/image_bda1d4e528.png /uploads/image_6cb783f093.png /uploads/image_d7839ce87f.png

Conclusion

This lab demonstrated the fundamental concepts of IAM user management and policy-based access control. By understanding how to create users, groups, and policies, and by testing the resulting permissions, you can effectively secure your AWS environment and maintain granular control over access to your resources.

Hashtags: #AWS # IAM # IdentityAccessManagement # Security # UserManagement # Policy # Permissions # AccessControl # CloudSecurity # AwsSecurity

Related Articles

thumb_nail_Unveiling the Haiku License: A Fair Code Revolution

Software Development

Unveiling the Haiku License: A Fair Code Revolution

Dive into the innovative Haiku License, a game-changer in open-source licensing that balances open access with fair compensation for developers. Learn about its features, challenges, and potential to reshape the software development landscape. Explore now!

Read More
thumb_nail_Leetcode - 1. Two Sum

Software Development

Leetcode - 1. Two Sum

Master LeetCode's Two Sum problem! Learn two efficient JavaScript solutions: the optimal hash map approach and a practical two-pointer technique. Improve your coding skills today!

Read More
thumb_nail_The Future of Digital Credentials in 2025: Trends, Challenges, and Opportunities

Business, Software Development

The Future of Digital Credentials in 2025: Trends, Challenges, and Opportunities

Digital credentials are transforming industries in 2025! Learn about blockchain's role, industry adoption trends, privacy enhancements, and the challenges and opportunities shaping this exciting field. Discover how AI and emerging technologies are revolutionizing identity verification and workforce management. Explore the future of digital credentials today!

Read More
Your Job, Your Community
logo
© All rights reserved 2024