Mobycast

The Amazon Elastic Container Service (or ECS) is the container orchestration system built by AWS. ECS features tight integration with many AWS services, and is a powerful choice for running containers in the cloud.

We first discussed ECS back in episode 3 of Mobycast. But so much has changed in the 18 months since then, bringing many major improvements. One new feature is Fargate, which brings the serverless concept to containers.

With Fargate, you no longer need to manage servers. You don't pay for idle CPU. And there is the promise of seamless scaling. Sounds perfect, right? Well, as with most things that sound too good to be true, there are some limitations and gotchas.

In this episode of Mobycast, Jon and Chris kick off a three-part series where we dive deep into Fargate. We learn the ins and outs of running containers without managing servers and discuss the trade-offs we make when ditching those servers.

Show Notes

Support Mobycast
https://glow.fm/mobycast

In this episode, we cover the following topics:
  • Amazon Elastic Container Service (ECS) basics
    • Orchestration system for containers
    • Well integrated with all the other Amazon services – More bang for your buck
    • ECS components
      • Cluster
        • Logical grouping of tasks or services
        • For EC2 launch type, set of EC2 instances that are defined and managed by:
          • Launch Configuration
          • Auto Scale Group
      • Service
        • Allows you to run and maintain a specified number of instances of a task definition simultaneously
        • For long-running applications
      • Task
        • Defines a collection of containers that you want to run together
        • Specifies resource quotas needed to run (e.g. memory, CPU, disk volumes)
    • Simple deployment with ECS
      • Build image, publish image, create task definition revision, update ECS service
  • Running containers
    • Three methods
      • Create a long running task
        • ECS service, service scheduler, integration with ELB
      • Run a single task
      • Create a scheduled task
    • We are going to focus on the most typical use case - ECS services
      • You have to choose a launch type
        • EC2 or Fargate
  • Fargate
    • Announced at re:Invent 2017
      • Generally available since 2018
    • What is it?
      • Allows you to run containers without having to manage servers or clusters of EC2s
        • Don't need to choose server types, decide when to scale your clusters, or optimize cluster packing
        • You get complete control over task placement within your own VPC
          • But underlying infrastructure is managed by Fargate
    • Benefits
      • No clusters to manage
      • Seamless scaling
      • Only pay for when you are running tasks
        • Ideal for batch jobs, cron jobs and other on-and-off workloads
        • Running cluster of instances constantly incurs costs, but Fargate stops billing when containers stop
    • Specifics
      • Each Fargate task has its own isolation boundary
        • It does not share the underlying kernel, CPU resources, memory resources, or ENI
          • Leverages Firecracker microVM
          • Increases efficiency (e.g. approximately 50% price cut for Fargate in January 2019 due to Firecracker)
      • Tasks must be launched into a cluster
        • Cluster is logical infrastructure and permissions boundary for isolating groups of tasks
        • Clusters support running both EC2 and Fargate launch types (mix-n-match)
      • Fargate tasks require awsvpc network mode
        • Provides each task with an ENI
          • You must specify one or more subnets
          • You must specify one or more security groups
        • Decide on whether to assign public IP address to ENI
          • If on public subnet, you must assign public IP to pull images
          • If on private subnet, just requires NAT gateway
      • You must specify CPU and memory at the task level
        • You can also optionally specify CPU and memory at container level
      • Only supports the following log drivers
        • awslogs
          • Sends log information to CloudWatch Logs
        • splunk
    • Pricing
      • Based on amount of CPU and memory used
      • Charged by the second, with minimum charge of 1 minute
      • Example costs for running a blog server 24x7
        • Note: costs for us-west-2 region
        • Fargate, 0.25 VCPU, 0.5GB memory
          • per vCPU per hour: $0.04048
          • per GB per hour: $0.004445
          • Memory = $1.60 (30 days * 24 hours * 0.5 GB * 0.004445)
          • CPU = $7.29 (30 days * 24 hours * 0.25VCPU * 0.04048)
          • Total = $8.89 / month
        • t2.micro, 1 VCPU, 1GB memory
          • per hour: $0.0116
          • Total = $8.35 (30 days * 24 hours * 0.0116)
        • t3.nano, 2 VCPU, 0.5GB memory
          • per hour: $0.0052
          • Total = $3.74 (30 days * 24 hours * 0.0052)
Links

End Song
ERRE - Lamictal

For a full transcription of this episode, please visit the episode webpage.

We'd love to hear from you! You can reach us at:

What is Mobycast?

A Podcast About Cloud Native Software Development, AWS, and Distributed Systems