How to launch/deploy Docker container in AWS ECS using FARGATE

How to launch/deploy Docker container in AWS ECS using FARGATE

February 14, 2019 / Eternal Team

Deploy Docker Container to the AWS Fargate Cluster

AWS Fargate was launched a few months back. This is a service that runs docker containers serverless, as per individual needs. AWS Fargate is a compute engine for Amazon ECS, allows you to run Docker containers without having to manage servers or clusters. With AWS Fargate, there is no need to scale, provision, or configure clusters of virtual machines to run containers. You don’t have to choose server types and how are they communicating together. You just have to focus on building and designing an application instead of managing the infrastructure that helps to run the application.

First of all, to understand the Container, we need to understand the difference between the Virtual machine and the Container technology.

What’s the Difference Between Containers and Virtual Machines?

The difference is all about how the application uses underlying hardware like RAM and CPUs efficiently. Containerization reduces waste of underlying hardware because each container only holds the application and related binaries or libraries. Containerization is a lightweight alternative to full machine virtualization that involves encapsulating an application in a container with its own operating environment. By allowing more containers in the environment without the need for more servers, containe]rization increases scalability anywhere from 10 to 100 times that of traditional VM environments.

After this little understanding of what is Container, Now the AWS Container management service which called Elastic Container Service (ECS) comes in the picture.

Elastic Container Service (ECS) 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. You can host your cluster on a serverless infrastructure that is managed by Amazon ECS, by launching your services or tasks using the Fargate launch type. For more control, you can host your tasks on a cluster of Amazon Elastic Compute Cloud (Amazon EC2) instances that you manage by using the EC2 launch type.

Fargate Launch Type AWS Fargate is a technology that you can use with Amazon ECS to run containers without having to manage servers or clusters of Amazon EC2 instances. With AWS Fargate, you no longer have to provision, configure, or scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing.

Flow chart of Fargate type Deployment

We can understand more about the fargate type clustering and deployment by following architecture. Fargate makes the dedicated and separate Elastic Network Interface for the single fargate task (Container). So every single container runs with its own security groups, ports, desired subnets and VPS. The fargate container have all the facilities which we get in EC2 instances. Additionally, Fargate allows Load balancing and autoscaling for the containers where we do not need to worry about any failure or downtime. It also allows blue-green auto deployment on the containers.

Benefits of Amazon Fargate

1) No Cluster management

With Fargate, you just have to think of containers and focus on building and operating your app. It eliminates the need for managing a cluster of Amazon EC2 Instances.

2) Seamless Scaling

It is possible in fargate, we can scale the size of any container or number of container in few clicks and within few minutes. Fargate allows you to launch thousands of containers together in seconds and easily scale to run your mission-critical applications.

3) Addressing Security

This is true that in fargate launch type we can not access the running container directly. So to deploy new version, we need to create new and run the new container by replacing old container.

5) Lower down the Costs

AWS Fargate not only manages the infrastructure but lower downs the overall application costs too. This charges us for what we have used. In the fargate container, we can set up the auto scaling which reduces the cost when traffic is not much, for example in the night time (When we talk about EC2 instance hosting). However, it is your responsibility to make sure that containers are densely packed onto instances to get maximum benefits out of them, otherwise, it will be merely a waste of money.

6) Reduces Complexity

Everybody knows that Kubernetes is the winner of the container orchestration market but you will realize that it is hard to scale or manage Kubernetes effectively. Realizing these challenges, Amazon released Fargate service where customers don’t have to worry about containers. Just define the parameters for containers and Fargate takes care of everything rest.

Use Cases

  • Managing a large cluster of EC2 instances is generally harder and you need to make sure that all instances are patched, secured, and updated with the latest version of Docker in the right way. If you don’t want to get into instance management then Fargate is the best choice here. It will deploy clusters automatically by taking care of the underlying infrastructure itself.
  • In case, the workload is small where the website has more traffic during the day and low traffic at night then AWS Fargate is again the best choice. You may scale down tiny container at night that costs you little and scale up again in the daytime when infrastructure requirements are higher. All this possible in a few seconds.
  • If there is a small test environment then AWS Fargate is a perfect fit. It is generally wasteful running tiny test environment on EC2 instance because EC2 instance is too powerful that you will have a hard time getting a good percentage of utilization.
  • When the workload is made up of consistent periodic tasks or occasional jobs that come from a queue then AWS Fargate is again a perfect choice. Instead of paying for an EC2 instance, you may use AWS Fargate to run your containers based on requirements.

Related Blogs

blog

March 14, 2019

Configure Instance Security-Group for WHM compatib...

Sharing is caring!

Here, we will see the ports that we need to be configured for WHM to function properly and a…..

blog

February 26, 2019

DNS – What it is, How it Works?...

Sharing is caring!

We go through the basics regarding what is a domain; what is a DNS Service; the basic require…..

blog

February 25, 2019

AWS Route-53 : The Swiss Knife for Domain Hosting...

Sharing is caring!

The general idea regarding ROUTE-53 is that it is a Domain hosting service, which is true. But, it provides…..

Want to start a project?

It’s simple.

Contact us