Enhancing AWS Security: A Step-by-Step Guide to Creating an IAM User and Configuring it on Your Computer.
Tags: aws, iam
Published: 2023-07-04 12:34:14



One of the most important and the first few services to learn on AWS cloud is AWS Identity and Access Management (IAM).

Amazon Web Services (AWS) offers Identity and Access Management (IAM) as a service, which enables users to manage access and permission to their AWS resources. 

In this blog post, I will guide you through the process of creating an IAM user on AWS and configuring it on your computer. 
Additionally, I will highlight the disadvantages of relying solely on the root user account for AWS resource creation and management.

**Creating an IAM User on AWS** 

1. Sign in to your [AWS Management Console]
(https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Fconsole.aws.amazon.com%2Fconsole%2Fhome%3FhashArgs%3D%2523%26isauthcode%3Dtrue%26nc2%3Dh_ct%26src%3Dheader-signin%26state%3DhashArgsFromTB_eu-north-1_2ec11cd8ac044daa&client_id=arn%3Aaws%3Asignin%3A%3A%3Aconsole%2Fcanvas&forceMobileApp=0&code_challenge=6wgxw8c5FAa1q0v1l_WNlk4GNhThUAq3ucRMeuoToH4&code_challenge_method=SHA-256) or [create an account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html?nc2=h_ct&src=header_signup) 

2. Navigate to the IAM service.
![IAM Service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/melvbaqg7tnxwkptj3d8.png)

3. Click on "Users" in the sidebar and then click "Add User"
![IAM Users](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfbgk5vltlgb1hb54n3r.png)
![Add Users](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykv2y3vzuqhpr0mct9xt.png)

4. Provide a name (**Olamilekan** in this case) for the user an access type (programmatic access, AWS Management Console access, or both).
![Provide Username](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbljn480nttc13179xyf.png)

5. Configure password for the user to be used at console sign-in.
![Configure password](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tnaf4m3ffozs6d79m85.png)

6. Set permissions for the user by attaching policies. AWS provides predefined policies or allow you to create custom policies to define access. In this case, AdministratorAccess was granted to the user **Olamilekan**
![Set user permission](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03n8x30yn22h7x4ffmbx.png)

7. Review the user datails and click "Create user".
![Review user details](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypflnenlro0sxke9d69p.png)

8. Click "Download .csv file" to download the Programmatic access credentials i.e (AWS Access Key ID & Secret Access Key ID).

![Download .csv file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aqnkzr3kaiyoujmpw06d.png)




**Configuring the IAM User on Your Computer**
1. Install [AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) (CLI) on your computer.
![AWS CLI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5elbysqnhjc6fio7icu.png)
![Installed successfully](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n93ff3pfzhpqzbrsdqz8.png)

2. Open a terminal or command prompt.
3. Run the command aws configure and provide the Access Key ID and Secret Access Key of the IAM user you created.
4. Specify the AWS region you want to use and the default output format.
5. Run "aws configure list-profiles" to view the added profile
![aws configure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0m4i9tr80v89arxjt1m6.png)

5. Verify the configuration by running a simple AWS CLI command, such as "aws ec2 describe-regions --query 'Regions[].RegionName' --output text" to display the available regions.

![aws cli command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mufql7vbdj0aofb0w95b.png)

In conclusion, sharing the root user credentials across multiple team members can pose security threats, complicates management and creates operational challenges. Revoking or rotating credentials becomes a cumbersome task, impacting security best practices.
IAM can be leveraged to provide appropraite permission to individuals or teams and reduce several risks associated with the root user account.