AWS Fargate features

AWS Fargate is one of the most interesting services of AWS is Fargate. I never imagined running containers with such great simplicity. Fargate is a fully managed Docker hosting ecosystem by AWS.

What is Fargate?

  • You don’t need to worry about managing and scaling clusters.
  • 24/7 uptime! Yes, think of it like Lamdas. Once the containers are running it will run without any need to provision or manage the cluster.
  • You can also schedule containers.
  • AWS maintains the availability of the underlying infrascture. You just create the container and push it. The rest is managed by AWS.
  • No more server type. One of the most time-consuming factors in EC2 is selecting the appropriate server type. With Fargate you just need to select the amount of RAM and CPU the task requires.

Is it expensive?

Yes, Fargate is expensive but in the long term, it turns out to be cheaper. The time you would need to invest in managing the clusters will be history. The only thing you would think about is just pushing the containers. Fargate pricing depends on the number of vCPU and RAM for a single task.

What is a Fargate task?

A task includes information about the Docker container. A task can include multiple containers.  In order to use Fargate, we have to create a task which includes the Docker image URL, CPU, memory and more details.

example:

  • The networking mode of the Docker.
  • logging configuration.
  • the command that should run when the task is started.
  • IAM Role of the task. <– this is important for example if the task is going to access SSM you would need to add the policy to the role.

The screenshot below shows a sample task definition. Each task has a unique name and a task role. The task size is important as it dictates the pricing fee.

 

 

 

Fargate disadvantages

  • Sadly every service has a few disadvantages. The most important is that you can’t mount a filesystem. However, if you have a requirement which needs a mounting AWS provides ECS EC2 Linux. With this, you have total control over the server.
  • Learning curve.  It takes a good amount of time to master it. Running a few tasks is not very challenging but when it comes to many tasks it comes to a little bit complex.

Which regions support Fargate?

  • Northern Virginia
  • Ohio
  • Oregon
  • Northern California
  • Montreal
  • AWS GovCloud (US-West)
  • AWS GovCloud (US-East)
  • Ireland
  • Frankfurt
  • London
  • Singapore
  • Tokyo
  • Sydney
  • Seoul
  • Mumbai

Fargate storage options?

Each Fargate task gets 10 GB of free storage. The storage is ephemeral, this means the data is deleted when the task is stopped or restarted.

There is also 4 GB for volume mounts, which can be shared across containers via the parameters in the task.

Where should you store the Docker images?

Fargate can pull Docker images from any private repository. It does need a bit of extra work but if you are looking to make it easy to consider using ECR.  If you are looking into how to utilize ECR have a read on the Codebuild Docker tutorial.