A Beginner's Guide to Amazon AWS IAM

Shashank VimalShashank Vimal
3 min read

AWS Identity and Access Management (IAM) is a service provided by Amazon Web Services (AWS) that helps you manage access to your AWS resources. Think of it as a security system for your AWS account.

Detailed components of IAM:

  1. Users:

    • Definition: IAM users are entities that represent individual people or applications that need access to your AWS resources.

    • Credentials: Each user has unique security credentials, such as a password for the AWS Management Console or access keys for programmatic access.

    • Permissions: Users can have policies attached directly to them, defining what actions they can perform on which resources.

  2. Groups:

    • Definition: Groups are collections of IAM users. They simplify the management of permissions for multiple users.

    • Usage: Instead of assigning permissions to each user individually, you can assign permissions to a group. All users in the group inherit those permissions.

    • Flexibility: Users can be added to or removed from groups as needed, making it easier to manage access control.

  3. Roles:

    • Definition: IAM roles are used to grant temporary access to AWS resources. They are not associated with a specific user or group.

    • Usage: Roles are typically used by applications, services, or users from other AWS accounts. For example, an EC2 instance can assume a role to access S3 buckets.

    • Permissions: Roles have policies attached to them that define what actions are allowed. When an entity assumes a role, it temporarily gains the permissions defined by the role’s policies.

  4. Policies:

    • Definition: Policies are JSON documents that define permissions. They specify what actions are allowed or denied on which resources.

    • Types:

      • AWS Managed Policies: Predefined policies created and maintained by AWS. They are designed to provide permissions for common use cases.

      • Customer Managed Policies: Policies that you create and manage. They offer more flexibility and control over permissions.

    • Structure: A policy document includes statements, each containing:

      • Effect: Whether the statement allows or denies access.

      • Action: The specific actions that are allowed or denied (e.g., s3:ListBucket).

      • Resource: The resources to which the actions apply (e.g., a specific S3 bucket).

Key Features of IAM:

  • Principle of Least Privilege: This principle ensures that users and entities are granted only the permissions they need to perform their tasks, reducing the risk of accidental or malicious actions.

  • Multi-Factor Authentication (MFA): MFA adds an extra layer of security by requiring users to provide a second form of authentication (e.g., a code from a mobile device) in addition to their password.

  • Audit Trail: IAM integrates with AWS CloudTrail to provide a record of all API calls made in your account. This helps you track user activity and changes to permissions, ensuring accountability and compliance.

Practical Example:

Imagine you have a team of developers working on a project. You can create IAM users for each developer, add them to a group called “Developers,” and attach a policy to the group that grants permissions to access the necessary AWS resources (e.g., EC2 instances, S3 buckets). If a new developer joins the team, you simply add them to the “Developers” group, and they automatically inherit the required permissions.

If you have an application running on an EC2 instance that needs to access an S3 bucket, you can create a role with the necessary permissions and allow the EC2 instance to assume that role. This way, the application can access the S3 bucket without needing to store long-term credentials.

By using IAM effectively, you can ensure that your AWS environment is secure and that access to resources is managed efficiently.

5
Subscribe to my newsletter

Read articles from Shashank Vimal directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shashank Vimal
Shashank Vimal

An individual who uses AI prompts, stack overflow threads and coffee to assemble software that occasionally works as expected...