Docker  >  Setting up AWS

Setting up AWS

Before getting started, please make a AWS account. Seperate from your Amazon account.

Create ECR Repository

AWS ECR Page

This is where your Docker Images will be stored

Create ECS Cluster

AWS ECS Cluster PageUse AWS Fargate

This is where your Docker containers are kept for your app. This also allows your app to run mutiple containers if needed.

Create ECS Task Definition

AWS Task Definition Page

Go to the Container and put in the following details and modify them if needed

  • Image URI = <ECR_REPO_URI>:<image_tag>
  • Port = 3000
  • CPU = 0.25vCPU
  • Memory = 0.5GB
  • Add environment variables

Create ECS Service

Go inside your cluster and create a new service. Input your task that was created and add networking and security if needed.

Create IAM User

AWS IAM Users Pagewith policy = AmazonEC2ContainerRegistryFullAccess

You can choose whatever policy. But this is what you need for a docker setup.

Make sure to copy the AWS Access Key ID and Secret Access Key for the next step, otherwise you will have to recreate the user.

Logging into AWS in Terminal

1
aws configure

Enter the following details when asked in Terminal. Anything else can just remain the default.

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default Region Name
1
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com

Login to AWS using the IAM user and remember to change the <account_id>


🙌 Congrats, you have completed setting up your AWS account to run the Docker Image and Container!