Create IAM (User, Roles and Policies)
Tags: aws, iam
Published: 2020-02-07 00:55:31

---
title: Create IAM (User, Roles and Policies)
published: true
date: 2019-12-26 13:47:31 UTC
tags: AWS,IAM
canonical_url: 
---

> **This article is the continuation of [WordPress with Docker, AWS (ECS, Code Pipeline, Load Balancer, RDS, EFS) Complete Series](https://dev.to/saluminati/high-traffic-wordpress-website-with-docker-aws-ecs-code-pipeline-load-balancer-rds-efs-complete-series-43id/). For better understating, please start from the beginning of the series.**

In this article, we will prepare our IAM User and attach [Amazon Elastic Container Registry (ECR)](https://aws.amazon.com/ecr/) policy to it. It will help us to push our local Dockerized WordPress to AWS ECR.

Other than that, we will create IAM Roles for our Services such as [CodeDeploy](https://aws.amazon.com/codedeploy/) and [CodePipeline](https://aws.amazon.com/codepipeline/) so that code is automatically deployed on change.

# Create ECR Policy

Login to your AWS console search IAM from the service tab and it will take you to the IAM Management Console. Click on Policies tab and select **Create policy**

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24063915/Screenshot_2019-12-11-IAM-Management-Console2-1024x863.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24063915/Screenshot_2019-12-11-IAM-Management-Console2-1024x863.png)

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064108/Screenshot_2019-12-11-IAM-Management-Console3-1024x544-1.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064108/Screenshot_2019-12-11-IAM-Management-Console3-1024x544-1.png)

Click on **choose a service** and select **Elastic Container Registry**. In the resource section, Select all resources.

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064334/Screenshot_2019-12-11-IAM-Management-Console4-1024x731.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064334/Screenshot_2019-12-11-IAM-Management-Console4-1024x731.png)

Give your policy a name and write that name down somewhere.

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064454/Screenshot_2019-12-11-IAM-Management-Console6-1024x506.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064454/Screenshot_2019-12-11-IAM-Management-Console6-1024x506.png)

# Create IAM User

We will now create an IAM User and attach the ECR policy we have create earlier.

From your IAM Management Console. Click on Users tab and select Add user and follow the simple steps to assign the newly created policy to the IAM User.

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064522/Screenshot_2019-12-11-IAM-Management-Console-1.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064522/Screenshot_2019-12-11-IAM-Management-Console-1.png)

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064549/Screenshot_2019-12-11-IAM-Management-Console7-1024x491.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064549/Screenshot_2019-12-11-IAM-Management-Console7-1024x491.png)

Finish all the steps until you see the following screen.

[![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064609/Screenshot_2019-12-11-IAM-Management-Console8-1.png)](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/24064609/Screenshot_2019-12-11-IAM-Management-Console8-1.png)

Download the CSV file, we need the credentials in that file in order to push our wordpress docker build to AWS ECR in the next article.