DEV Community

Cover image for Introduction to AWS IAM: Identity and Access Management.
Ifeanyi Duru
Ifeanyi Duru

Posted on

Introduction to AWS IAM: Identity and Access Management.

Overview: AWS Identity and Access Management (IAM) offers comprehensive management of permissions within your AWS account, allowing precise regulation of user access to specific services and resources. With IAM policies, you can tailor permissions for users or applications, ensuring they only have access to the resources necessary for their tasks, and defining conditions for how and when access is granted.

Key Components of IAM:

  1. Users: Users are entities that represent individual people, applications, or services that interact with AWS. Each user has a unique name and credentials (username and password or access keys) for accessing AWS resources.

  2. Groups: Groups are collections of users. Instead of attaching policies directly to individual users, you can create groups, assign policies to them, and then add users to those groups. This simplifies permission management, especially in larger organizations with multiple users.

  3. Policies: Policies are JSON documents that define permissions. You can attach policies to users, groups, or roles to grant or restrict access to AWS resources. Policies specify what actions are allowed or denied on which resources. AWS provides managed policies with predefined permissions, or you can create custom policies tailored to your specific needs.

  4. Roles: Roles are similar to users, but they are not associated with a specific person or identity. Instead, roles are meant to be assumed by entities such as AWS services, applications, or users from another AWS account. Roles define a set of permissions, and when an entity assumes a role, it temporarily takes on those permissions.

Core Concepts:

  1. Authentication: The process of verifying the identity of a user, application, or service. IAM supports various authentication methods, including username/password authentication for users, and access keys for programmatic access by applications or scripts.

  2. Authorization: Determining what actions a user, group, or role is allowed to perform on AWS resources. This is controlled through IAM policies, which define the permissions associated with each entity.

  3. Least Privilege: Following the principle of least privilege means granting users, groups, and roles only the permissions they need to perform their intended tasks, and no more. This reduces the risk of unauthorized access and potential security breaches.

Project Objective

In this project, the following tasks will be accomplished.

  1. Create a user,
  2. ⁠Create a group and add the user to the group,
  3. ⁠Attach 3 policies to that group: the user must have the ability to create IAM user, vpc, and s3 policies,
  4. ⁠Create a customized customer-managed policy to deny a user access to creating an RDS instance snapshot and allow the user to create an EC2 instance,
  5. ⁠Create an organization: add two accounts to the organization 1: Developer account and 2: An operations account and switch roles between the accounts.

A step-by-step pictorial approach will be used for better guidance and understanding.

To start with, Open your web browser and go to the AWS Management Console at https://aws.amazon.com/console/.
Sign in using your AWS account credentials.

Once you're logged in, navigate to the IAM dashboard.

In the top-left corner, search for "IAM" in the services search bar, and select "IAM" from the results.

Image description

IAM allows you to manage access to AWS services and resources securely.

Task 1:

Click on users in the left-hand corner to create a user. Then click on create a user.

Image description

Input your desired user name, then click next.

Image description

Image description

Task 2:
Next, our task is to create a user group and add the user into the group.

To achieve this, click on create user group. Input the group user name and click on create user group.

Image description

Image description

We then need to add the user to the group we created. To get this done, click on the group name and then click on add users.

Image description

Then input the user name in the search bar and add user to the group.

Image description

Image description
We have successfully created a user and added the user to a group.

Task 3:
The next step is to attach policies to the user group we created.

To attach policies click on permissions by the right of users tab.
Image description

then click on the add permission arrow on the right-hand side, and click on attach policies.

Image description

On the permission policies screen, to add IAM policy, search for IAMfullacess.

Image description

Image description

check on IAMfullacess and click attach policies

Image description

Image description

IAMfullacess policy has been successfully attached to the group.

Repeat the above steps to attach vpc and s3 policies to the group.

Image description

Image description

All 3 policies attached

All three policies have been attached to the group.

Task 4:

*Now, we have to customize a customer-managed policy to deny a user from creating an RDS instance snapshot, while allowing the user to create an EC2 instance. *

To create a customized policy, we will click on the permission policy arrow by the right hand, then click on create an inline policy.

Image description

Image description

On services, choose RDS

Image description

Select All RDS and all resources, then select deny, and click next.

Image description

Then create policy.

To allow the user to create an EC2 instance, go to inline policy, and click on services, then click on EC2.

Image description

Image description

All policies have been applied.

Task 5:

The last task of this project is to create two accounts and be able to switch between roles.

Creating accounts under the AWS organization to switch roles.

First, go to AWS organization and click on create an account, fill in the details, and create an account.

Image description

Image description

After creating an account, we will need to create roles for each account. To do this, navigate to role in IAM features, then create roles.

Image description

Under trusted entity type, select AWS account and under an AWS account choose this account, then next.

Image description

Attach administrator access to the role, click next.

Image description

Put in the role name and create role.

Image description

Do this for any more roles you want to create.

To switch roles, navigate to IAM dashboard and click on the top right corner arrow, then click on switch role.

Image description

Put in the account ID and the ARN characters from the account role then switch.

Image description

Thanks for reading through to this point. I'm assured you have gotten insightful steps to guide you on exploring the AWS IAM feature.

Feel free to comment and ask questions where necessary, I'll be glad to respond.

Cheers.

Top comments (0)