AWS Fargate

AWS Fargate is a serverless compute engine for containers (it is a method to launch container services) that works with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS). The provisioning of infrastructure and the management of servers is handled by AWS.

  • Obviates the provisioning and management of servers

  • Reduces costs by matching resource with workloads

  • Enhances security with an application isolation architecture

  • Simplifies the management of Kubernetes and Docker deployments.

  • Fargate offers “Containers as a Service”

Cluster

An Amazon ECS cluster is a logical grouping of tasks or services. Your tasks and services are run on infrastructure that is registered to a cluster.

  • A cluster may contain a mix of tasks hosted on AWS Fargate, Amazon EC2 instances, or external instances.

  • A cluster may contain a mix of both Auto Scaling group capacity providers and Fargate capacity providers, however when specifying a capacity provider strategy they may only contain one or the other but not both.

Task

The running container. It will run in a cluster by a Service (used to maintain a desired count of tasks) being created. Fargate runs each task or pod in its own kernel, providing the tasks and pods their own isolated compute environment. Traffic can be sent to other containers or services, such as AWS RDS.

Task Definition

Defines which images are you going to use, allocate CPU and Memory requirements

  • Immutable, versioned document

  • Identified by family:version

{
    "family": "chat",
    "containerDefinitions": [
        {
         "name":"chat=app",
         "image":"xxx.dkr.ecr.us-east-1.amazonaws.com/image.png"   
        }
     ]
}

Units

  • CPU & Memory Specification

    • CPU: cpu-units, 1 vCPU = 1024 cpu-units

    • Memory measured in MB

Task Level Resources

  • Total CPU/Memory across all containers

  • Required fields

  • Billing axis

Container Level Resources

  • Defines sharing of task resource among containers

  • Optional fields

Task CPU Memory Configurations

CPU Memory
256 (.25 vCPU) 512MB, 1GB, 2GB
512 (.5 vCPU) 1GB, 2GB, 3GB, 4GB
1024 (1 vCPU) 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
2048 (2 vCPU) Between 4GB - 16GB in 1GB increments
4096 (4 vCPU) Between 8GB - 30GB in 1GB increments

Pricing

  • Pay for what you provision.

  • Billed for Task level CPU and Memory.

  • Per-second billing. 1 minute minimum.

VPC Integration

Amazon Virtual Private Cloud (Amazon VPC) is a service that lets you launch AWS resources in a logically isolated virtual network that you define. You have complete control over your virtual networking environment, including selection of your own IP address range, creation of subnets, and configuration of route tables and network gateways.

  • Logically isolated portion of the AWS could within a region

  • Subnets created within AZs

  • An Internet Gateway is used to connect to the Internet

  • You can launch virtual servers into your VPC subnets

  • Integrate with Fargate

    • Launch your Fargate Tasks into subnets

    • You can assign public IPs to your tasks


References

AWS for Solutions Architects | Packt

Containers on AWS: An Introduction

Deep Dive into AWS Fargate

AWS Basics for Beginners - Full Course - YouTube