Introduce AWS Fargate
AWS has been able to manage and run Docker containers for a long time using ECS, or Elastic Container Services. I found that it’s difficult to operate unless you start from an understanding and with infrastructure as code. In startup mode, that’s not always easy, so I led myself wrong and got stuck in a manual maintenance mode of ECS.
ECS allowed you to store Docker images in a registry, like you would in Dockyard or any other Docker registry. You could then create Tasks, which was the definition of how to run the Docker image. The task configured things like port forwarding, disk mounting and kept a link to the tagged Docker image. Next step to actually run the Task was to set up a Service. The service provisions a certain number of tasks to run. Then you configure which ECS Cluster to run the tasks on. Finally, the conditions to auto scale the service by adding or removing instances of the tasks/image.
Here’s a snippet from the AWS blog:
AWS Fargate is an easy way to deploy your containers on AWS. To put it simply, Fargate is like EC2 but instead of giving you a virtual machine you get a container. It’s a technology that allows you to use containers as a fundamental compute primitive without having to manage the underlying instances. All you need to do is build your container image, specify the CPU and memory requirements, define your networking and IAM policies, and launch. With Fargate, you have flexible configuration options to closely match your application needs and you’re billed with per-second granularity.
Fargate solves an important pain point with ECS. The ECS cluster of EC2 instances. You, as an administrator/devops engineer on your AWS account, needs to provision a ECS cluster. That’s a fancy and abbreviated way of saying: “Create an autoscaling group, using a launch configuration that has User Data configured to join the ECS Cluster that you’ve defined.”…. Not difficult by any stretch, but, it’s always felt like a layer that shouldn’t be there.
I always found auto scaling to be a challenge. Are you autoscaling your ECS Service? Are you auto scaling the ECS cluster? Yeah, you kind of have to do both.
Frankly, since I was in startup mode when dealing with ECS primarily, and believe me I dealt with ECS a ton, I never took the time or bothered to figure out how to ‘get it right’…
I got it working. In startup land, getting it working is first and foremost… getting it done “right” is secondary (as long as you aren’t getting it done awfully poorly)….
Back to the point of Fargate. This is a major simplification of the ECS/Docker process. Now, you can configure a group of ECS tasks to run without configuring the EC2 cluster.
The magic happens behind the scenes, managed 100% by AWS. You are even presented with a “Fargate” cluster when you look at your ECS clusters in the web user interface for ECS.
Amazon has taken away the need to be particular about how your tasks are running across your instances. You don’t have to stress about making sure you’re using your ECS Cluster optimally. AWS takes care of scaling your tasks to meet your jobs’ needs.
This simplification will now make Docker containers a first class citizen within AWS. This is a huge change and will definitely streamline administration and provisioning of your containers.