Skip to content
Menu
Sri Kode
  • Home
  • Contact
Sri Kode
January 5, 2025January 5, 2025

IAM (Identity Access Management) in AWS

Imagine your AWS environment as a high-security building. Not everyone can waltz in and do whatever they like. That’s where AWS Identity and Access Management (IAM) steps in, acting like the building’s security system. It ensures that only the right people (or applications) can access the right rooms (AWS resources) and only perform specific tasks.

Let’s break it down.

What’s IAM All About?

IAM is all about Authentication (proving you belong here) and Authorization (defining what you’re allowed to do).

Here’s a simple analogy:

  • Authentication: Like swiping your office badge to enter the building.
  • Authorization: Once inside, your badge determines if you can enter the server room, pantry, or just your cubicle.

Here’s what IAM gives you to manage access like a pro:

1. Users

Think of users as individual employees. They get personal access to the system.

2. Groups

A group is like a department, say, HR or Finance. Everyone in the group shares similar access privileges.

3. Permissions

These are like job roles. They define what someone (or a group) can do. For example:

  • Access EC2 servers.
  • Read/write files in S3.

4. Policies

Policies are the rulebooks that grant permissions. Written in JSON, they tell IAM who can do what with which resources.

How Does It Work?

Step 1: Create a User

Say you hire John. You create an IAM user for him with a name and credentials. If he needs access to the AWS Console, you enable console access and set a password.

Step 2: Add Permissions

By default, John won’t have access to anything. You need to attach permissions to him.

  • You can give permissions directly to John.
  • Or better, add him to a group (like Audit), and attach permissions to the group.

Step 3: Use Policies

Policies define what John can do. For example:

  • ReadOnlyAccess: John can only view resources but can’t change anything.
  • S3FullAccess: John can manage everything in S3.

AWS IAM Policies

Policies in IAM are like recipes. Each one specifies:

  • Actions: What can be done (e.g., s3:ListBucket).
  • Resources: Where it can be done (e.g., a specific S3 bucket).
  • Effect: Whether to allow or deny access.
  • Conditions: Extra rules (e.g., allow access only during office hours).

Types of Policies

  1. Identity-Based Policies
    • Attached to users, groups, or roles.
    • Example: Give the Audit group permission to view all S3 buckets.
  2. Resource-Based Policies
    • Attached directly to a resource, like an S3 bucket.
    • Example: Allow a third-party app to access a specific bucket.
  3. Inline Policies
    • Quick, one-off policies for temporary needs.
    • Example: Let a user upload files to a bucket just for today.
  4. Managed Policies
    • Pre-built by AWS (or custom ones you create).
    • Example: Use AWS’s EC2ReadOnlyAccess policy to save time.

Practical Example: S3 Bucket Access

Let’s make this real.

Scenario:

You have an Audit team. They should:

  1. See a list of S3 buckets.
  2. View objects inside specific buckets.

Solution:

  1. List Buckets:
    • Create a policy with the s3:ListAllMyBuckets action and attach it to the Audit group.
  2. List Objects:
    • Edit the policy to add s3:ListBucket for specific bucket ARNs.

⚠️ Pro Tip: If you skip Step 1, users can’t see objects because they need to see the bucket first!

Inline Policies: When Quick Fixes Are Needed

Need something done urgently, like uploading files to S3? Use an inline policy.

  1. Go to the user or group, create an inline policy, and specify s3:PutObject for the bucket.
  2. Once the task is done, delete the policy.

Inline policies are perfect for short-term or emergency tasks.

What About Roles?

Roles are like temporary badges for services or external applications.

Example:

Your application is hosted on-premises but needs to access a database in AWS. Here’s what you do:

  1. Create a role in IAM with the required permissions (e.g., read data from the database).
  2. Share the role with the app developer so the app can use it securely.

Roles are also handy for cross-account access or granting permissions to AWS services like Lambda or EC2.

By mastering IAM, you’re not just improving security, you’re also making your AWS environment easier to manage. Ready to set up your first user or policy? Dive in and give it a try!

«Previous Post
Next Post»

To dive deeper… Check out these related topics:

  • AWS
  • DevOps
  • Docker
  • Introduction
  • Jenkins
  • Terraform

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Preventing Data Loss in Containers with Docker Volumes
  • Fixing “Permission Denied” Errors in Containers
  • Fixing Port Accessibility Issues in Docker Containers
  • Artifact Repositories in DevOps: Why They Matter
  • Commonly Used Maven Build Targets in Daily DevOps Workflows
©2025 Sri Kode