Member-only story
AWS Container Services
Create a simple flask Rest API, containerise it using docker and deploy it as service in Elastic Container Service

AWS provides container services to deploy and run container applications. One of the services is Elastic Container Service i.e. ECS. In this article, we will see how to create a sample flask RestAPI, containerize it with docker and deploy this docker image to ECS.
Before we start, lets define few terms:
Docker — Docker is a container technology that helps to containerize our applications. Check out here for more details.
Containers — A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. Check out here for more details.
ECS — Elastic Container Service is an AWS managed service that helps us deploy and run our container applications in the cloud environment. Check out here for more details.
ECR — Elastic Container Registry is a fully-managed docker container registry that makes it easier for developers to store, manage, and deploy docker container images. Check out here for more details.
Now lets create a small flask application and deploy it as container application in AWS ECS.
1. Installation
1.1. Following instructions are for installing docker on ubuntu. For other distributions, please check instructions here :
$ sudo apt-get update -y && sudo apt-get install -y linux-image-extra-$(uname -r)
1.2. Install docker
$ sudo apt-get install docker-ce -y
1.3. Start Docker
$ sudo service docker start
1.4. Verify Docker
$ sudo docker run hello-world
1.5. Create a docker group and add user to group
$ sudo groupadd docker && sudo usermod -aG docker ubuntu