For those who had just started, we’ll have a look at docker and ECS.

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code. In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.

Amazon Elastic Container Service (Amazon ECS) is a highly scalable, high-performance container orchestration service that supports Docker containers and allows you to easily run and scale containerized applications on AWS. Amazon ECS eliminates the need for you to install and operate your own container orchestration software, manage and scale a cluster of virtual machines, or schedule containers on those virtual machines.

Creating a docker image

You can create a docker image by using Dockerfile or else you can create an image by configuring existing image manually. I’ll go with existing httpd image and configure it as I want, So let’s start.

  1. Log in to AWS and go to Services-> ECR, and create an ECR repository


  1. Give a title to the repository.

    this title should be more specific. While downloading this image the same title is used with versions


  1. For command help, you can use View push commands tab, which will include all commands used for uploading an image to your AWS repository


Popup will appear with some commands as follows


  1. Executing the first command to log in
aws ecr get-login --no-include-email --region ap-south-1


copy the output and execute that command, after that ![login-img]//img/aws-ecr/6.png) message will appear.

  1. Pull an image from docker hub or create from Dockerfile. I’ll pull httpd from docker hub
docker pull httpd

Now it’ll download an image to your local machine and to see it you can also use

docker images

Following will be the output of “docker images

#   REPOSITORY     TAG        IMAGE ID            CREATED             SIZE
#   httpd          latest     d4a07e6ce470        12 days ago         132MB
  1. Take ssh of httpd image to configure it manually. ssh-httpd-image

    update /urs/local/apache2/htdocs/index.html and change the content.


to save the image with its content it needs to be committed.


  1. After committing an image it can be pushed to AWS ECR(Elastic Container Registry)

    docker push <your ECR url>/test-http-server:latest


After push completes it will reflect at the test-http-server repo.


  1. Now we’ll need to create a cluster so that we will be able to launch multiple instances in the same cluster. We’ll be creating EC2 cluster.

Follow the screenshots given below.

aws-login aws-login aws-login aws-login aws-login aws-login aws-login aws-login aws-login aws-login aws-login aws-login