How to setup and configure an IAM user in AWS
Published: 2022-07-04 23:55:15

AWS Identity and Access Management (IAM) is an AWS service, designed for access control across all of AWS.
you use IAM policies, to manage permissions and to ensure least-privilege permissions, throughout your workforce and systems.

Now, lets create an IAM User.

## IAM User Setup
### Step 1
Create an AWS root account, on the AWS [console](https://aws.amazon.com/console/)

### Step 2
Login to your AWS console, on the top left corner, click on **Services >** **Security, Identity & Compliance** then click on **IAM**

![Aws Security, Identity & Compliance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wa50d7snahd85r12azpd.JPG)

![IAM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9s7jy6szkvcafee2njh3.JPG)

### Step 3
Click on **User** on the left navigation bar, then on the User dashboard click on **Add User**


![User dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/siskyrnvppixvfp9wvbp.JPG)


### Step 4
Enter your username and for Select AWS credential type, select **Access key - Programmatic access**
click on Next

![AWS IAM User setup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y13gkfd89unnt5kkvmg4.JPG)

### Step 5
Set permissions, on this page, click on Attach existing policies directly.

![Aws Attach Policies](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aozy1z9t77nyeh0zfu47.JPG
)
You can attach any policy depending on your workload, but for this exercise choose **AmazonS3FullAccess**.
This policy gives this user full access to Amazon Simple Storage Service (S3)

Next **Tags**, Next **Review**

Click on **Create User**

### Step 6
This step is very Important.
Your user Access key ID and Secret access key are displayed on this final page. You also have the option to download your credentials in csv format.

Keep your credentials safe, as you would be needing it to configure AWS CLI on your local environment.

> Note: do not reveal your AWS credentials to anyone, as they would have access to your user and all its resources.
Keep your credential private

**_You have successfully created an IAM User using the AWS console.
_**

Now lets increase the pace, for this next session we would be configuring our IAM User using the AWS CLI.

Lets dive in!


![dive in](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gegtak2op9flzja5spis.gif)



## Configure IAM User using AWS CLI
You would need to install [Git ](https://git-scm.com/downloads)for this section

### What is AWS CLI?
It stands for Amazon Web Service Command Line Interface a unified tool to manage your AWS services.
The CLI is used to download, configure and control multiple AWS services.

Follow this [Article](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) to install [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

After installation, we can begin with configuration.

### Step 1
Open your terminal, then use this command

```
aws configure
```

Input your IAM User credentials, Access key ID, Secret access key, Region (use _us-east-1_ for this example), for default output format, input _JSON_


![AWS configure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1my6zwjfeeme2pnrfss.JPG)

### Step 2
run 

```
cat ~/.aws/credentials
```
 on your terminal, compare the credentials displayed to what is on the _csv _file you downloaded earlier. If they match move to the next step.

![Aws credentials](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aupuu0ak9n1x42tu1amw.JPG)

### Step 3
run 

```
aws sts get-caller-identity
```
You should get an output similar to this.

![caller identity](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oieskjv6spnjkd90xic8.JPG)

### Step 4
run 

```
aws iam list-users
```
You should get an output similar to this.

![Iam list-users](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/llk0yit5uys9pkp0wnoq.JPG)


**You have successfully configured an IAM user locally, using AWS CLI**

> If you run into any errors while setting up any of the above mentioned installation or errors while following any of the steps, feel free to message me directly. I am here to help.

If this post has in anyway added value to you, show some support, like, share, subscribe.