AWS ECS Fargate – How to Launch/Deploy Docker Container

AWS ECS Fargate – How to Launch/Deploy Docker Container

February 14, 2019 / Nirav Shah

AWS ECS Fargate: Deploy Docker Container, Benefits, Use Cases

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, that 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 they are 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. Fargate allows Load balancing and autoscaling for 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 a 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.

ECS Vs Fargate Vs EKS

Talk to AWS Certified Consultant

    Spread Love By Sharing:

    Let Us Talk About Your AWS Development Requirements

    Have queries about your AWS project ideas and concepts? Please drop in your project details to discuss with our AWS experts, professionals and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project