Amazon Elastic Container Service (Amazon ECS)
Cloud service · AWS · Updated

Amazon Elastic Container Service (Amazon ECS)

In short

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that allows you to run and scale containerized applications on AWS.

Cloud Services Hub →

Free Amazon Elastic Container Service (Amazon ECS) tools

10 key features of Amazon Elastic Container Service (Amazon ECS)

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that allows users to deploy, manage, and scale containerized applications using Docker containers on AWS.

01
Scalability

Amazon ECS automatically scales your applications in response to varying load and performance requirements, ensuring efficient resource utilization.

02
Container Orchestration

ECS simplifies the installation and operation of containerized applications by providing automated container management, task placement, and scheduling.

03
Integration with AWS Services

ECS integrates seamlessly with other AWS services such as Elastic Load Balancing, Amazon VPC, and AWS IAM for enhanced functionality and security.

04
Flexible Scheduler

ECS features a flexible task scheduling system which supports cron-like tasks for automated scheduling and execution of container workload.

05
High Availability

Services running on ECS are designed for high availability, distributing your containers across multiple Availability Zones within a region for improved fault tolerance.

06
Security

Amazon ECS leverages AWS IAM to provide role-based permissions for containers, ensuring that resources are accessed securely.

07
Developer Productivity Tools

ECS supports Docker and is compatible with developer tools and workflows, making it easier to build and deploy container applications.

08
Cost-Effective

With AWS Fargate, Amazon EC2, or AWS Outposts, there is no ECS management fee; you pay for the underlying compute resources.

09
Multi-Container Tasks

An ECS task can group multiple containers that share resources such as disk volumes or networks.

10
EC2 Cluster Auto Scaling

Amazon ECS can manage the scaling of Amazon EC2 instances registered to your cluster.

Where Amazon Elastic Container Service (Amazon ECS) is used

Amazon Elastic Container Service (Amazon ECS) is widely used for running containerized applications at scale, managing batch processing jobs, facilitating microservices architectures, and ensuring seamless application migration to the cloud.

  1. 01
    Microservices Management

    Amazon ECS simplifies the deployment, management and scaling of microservices. It allows developers to launch and manage containerized applications, grouped in tasks and services, ensuring that the infrastructure adapts dynamically to the application needs.

  2. 02
    Batch Processing

    ECS is ideal for batch processing jobs that require running processes in parallel at scale. Companies can efficiently manage batch workloads, schedule jobs, and scale resources as needed, optimizing both time and cost.

  3. 03
    Continuous Integration and Continuous Deployment (CI/CD)

    ECS integrates with CI/CD tools to automate the deployment pipeline. This enables developers to automatically build, test, and deploy their applications to production environments, ensuring more frequent and reliable software delivery cycles.

  4. 04
    Application Migration

    Amazon ECS supports businesses in migrating legacy applications to containerized environments. By deploying on ECS, companies can leverage the scalability and flexibility of cloud computing, while maintaining or improving their application's performance and reliability.

  5. 05
    Machine Learning Workloads

    Using ECS for machine learning tasks enables scaling and managing containerized machine learning models efficiently. ECS can handle various aspects of machine learning workflows, including data processing, model training, and inference, providing robust orchestration and management capabilities.

How Amazon Elastic Container Service (Amazon ECS) is priced

Amazon Elastic Container Service (Amazon ECS) pricing is based on the resources you use, such as the number of Amazon Elastic Compute Cloud (EC2) instances or the AWS Fargate capacity you deploy, with no upfront fees or long-term commitments.

Fargate Pricing

With the Fargate launch type, you pay for the vCPU and memory resources your containerized application requests. Usage is calculated from the time container images are pulled until the ECS task terminates, rounded up to the nearest second, with a one-minute minimum charge.

EC2 Pricing

There is no additional ECS charge for the Amazon EC2 compute option. You pay for the AWS resources you create to run your application, such as EC2 instances, EBS volumes, and public IPv4 addresses.

ECS Anywhere Pricing

ECS Anywhere allows you to run ECS on your own infrastructure. You are billed a flat rate per instance registered to your ECS cluster per hour, irrespective of the instance's size and operating system. This fee covers the capability to use ECS to manage containers in your own infrastructure.

ECS Managed Instances Pricing

ECS Managed Instances charges a per-instance management fee in addition to standard EC2 instance charges. Both charges are billed per second with a one-minute minimum, based on instance type and duration.

Fargate Spot Pricing

Fargate Spot offers interruption-tolerant ECS tasks discounts of up to 70% compared with Fargate On-Demand rates. Prices fluctuate with available capacity, and tasks can be interrupted with a two-minute warning when AWS needs capacity back.

Compute Savings Plans for Fargate

Compute Savings Plans offer savings of up to 52% in exchange for a one-year or three-year hourly spend commitment, automatically applying across EC2 and Fargate usage regardless of instance family, size, operating system, tenancy, or AWS Region.

ECS on AWS Outposts Pricing

ECS on AWS Outposts has no additional ECS charge; customers pay for Outposts capacity.

Fargate Ephemeral Storage Pricing

Each Fargate task includes 20 GB of ephemeral storage at no additional charge; configured storage above 20 GB, up to a maximum of 200 GB, incurs an additional charge.

Services Amazon Elastic Container Service (Amazon ECS) works with

Amazon EC2Amazon EC2

Amazon ECS can launch and manage containers on Amazon EC2 instances. Users can define a cluster of EC2 instances to run containerized applications.

AWS FargateAWS Fargate

AWS Fargate provides a serverless compute engine for containers. It allows users to run containers without managing the underlying infrastructure.

Amazon API GatewayAmazon API Gateway

Amazon ECS services can be exposed through API Gateway HTTP APIs using private integrations. API Gateway can discover ECS task endpoints through AWS Cloud Map or route requests through a load balancer serving the ECS service.

Amazon CloudWatchAmazon CloudWatch

Amazon ECS publishes service and cluster metrics to CloudWatch, and the awslogs log driver sends container output to CloudWatch Logs. Container Insights adds task- and container-level observability for troubleshooting resource usage and performance.

Amazon CodeGuruAmazon CodeGuru

Applications in ECS tasks can use the CodeGuru Profiler agent to collect runtime profiles. These profiles help identify expensive code paths and CPU bottlenecks in containerized applications.

Amazon Data FirehoseAmazon Data Firehose

Amazon ECS tasks can use FireLens with AWS for Fluent Bit to send container logs to Amazon Data Firehose delivery streams. Firehose can then buffer and deliver those logs to destinations such as Amazon S3.

Amazon DevOps GuruAmazon DevOps Guru

DevOps Guru can analyze operational metrics for ECS services to detect anomalous behavior. Its insights help investigate issues such as unusual CPU or memory utilization.

Amazon EC2 Auto ScalingAmazon EC2 Auto Scaling

Amazon ECS capacity providers connect clusters to EC2 Auto Scaling groups. ECS managed scaling adjusts the group's instance capacity to accommodate tasks, while managed termination protection helps prevent instances running tasks from being terminated prematurely.

Amazon ECS AnywhereAmazon ECS Anywhere

ECS Anywhere extends ECS task scheduling and management to registered servers and virtual machines outside AWS. External instances run the ECS agent and Systems Manager Agent so they can participate in an ECS cluster.

Amazon Elastic Block Store (Amazon EBS)Amazon Elastic Block Store (Amazon EBS)

Amazon ECS can provision and attach EBS volumes to supported tasks using task volume configurations and an infrastructure IAM role. This gives containers block storage whose size, type, encryption, and initialization settings can be specified at deployment.

Amazon Elastic Container Service (Amazon ECS) exam questions

Real practice exam questions on Amazon Elastic Container Service (Amazon ECS), with the correct answer and its explanation. Answer them with every option in the exam simulator.

CLF-C02

A company is deploying a containerized application on AWS. It wants a managed service to schedule containers and replace failed containers without adopting Kubernetes. Company policy also requires administrators to install security agents directly on the underlying compute instances. Which solution best meets these requirements?

Show answerCORRECT ANSWER

Use Amazon ECS with Amazon EC2 instances.

Amazon ECS provides managed container orchestration without requiring Kubernetes. Using EC2 instances for capacity allows administrators to access the hosts and install security agents.

MLA-C02 (beta)

A retailer is deploying two CPU-based inference APIs from separate container images: a recommendation model and a fraud detection model. Requests to /recommend/* must reach only the recommendation model, and requests to /fraud/* must reach only the fraud detection model. Traffic patterns differ significantly, so each model must have its own replica count and scaling policy. The team must also be able to deploy a new version of either model without replacing replicas of the other model. The company wants managed container orchestration without managing worker instances or adopting Kubernetes.

Which deployment configuration meets these requirements?

Show answerCORRECT ANSWER

Create a separate Amazon ECS task definition and service for each model on AWS Fargate. Give each service its own scaling policy and Application Load Balancer target group, and use path-based listener rules to route requests.

Separate ECS services provide independent desired task counts, scaling policies, and deployments. Separate target groups and path-based listener rules route requests to the appropriate model. Fargate removes the need to manage worker instances.

SAP-C03

A company deploys an Amazon ECS service on AWS Fargate behind an Application Load Balancer by using AWS CodeDeploy blue/green deployments. The deployment group already monitors application error-rate alarms and automatically rolls back when an alarm enters ALARM. The original task set remains available throughout traffic shifting.

The company's release policy now requires production traffic to move to the replacement task set in equal increments of 20 percentage points, with 3 minutes between successive increases, until the replacement receives all production traffic. The pipeline must use managed traffic shifting without scripts that modify listener weights.

Which change should a solutions architect make?

Show answerCORRECT ANSWER

Create a custom CodeDeploy deployment configuration for the ECS compute platform with linearPercentage set to 20 and linearInterval set to 3. Configure the deployment group to use this configuration.

CodeDeploy supports custom linear deployment configurations for Amazon ECS. These settings increase the replacement task set's traffic share by 20 percentage points at 3-minute intervals. The deployment group's existing alarm monitoring and automatic rollback settings remain applicable.

Practice Amazon Elastic Container Service (Amazon ECS) in a full exam

Questions on Amazon Elastic Container Service (Amazon ECS) in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Amazon Elastic Container Service (Amazon ECS)

3 min read

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. ECS can be used to launch and stop container-based applications with simple API calls, allows you to get the state of your cluster from a centralized service, and gives you access to many familiar Amazon EC2 features. 

Amazon ECS eliminates the need for you to install, operate, and scale your own cluster management infrastructure. With simple API calls, you can set up and manage a distributed system of highly available container applications throughout the entire lifecycle including installation, scaling, monitoring, and management. ECS is deeply integrated with familiar features such as Amazon EC2, Amazon CloudWatch, Elastic Load Balancing, and AWS Identity and Access Management (IAM), which provides robust security without the need for you to implement your own container security system. ECS allows you to launch your applications in a secured, managed, and scalable environment. It schedules your containers across your cluster based on your resource needs and isolation policies. This provides high levels of availability and scalability by running on a diverse set of Amazon EC2 instance types and sizes. 

For tasks running on EC2, the instance registration quota is 5,000 EC2 instances per cluster. This can constrain deployments using either Auto Scaling group capacity providers or self-managed instances; additional capacity can require more clusters or a quota increase.

For even more fine-grained control, Amazon ECS supports tasks definitions that allow you to specify the CPU and memory requirements, restart policies, and more for each container. 

One of the key benefits of Amazon ECS is its integration with AWS Fargate, which takes the hassle out of managing servers and clusters. Instead, with Fargate, you only worry about defining your applications and their requirements. The infrastructure needed to run these applications is fully managed by AWS, which allows you to focus on designing and building your applications instead of managing the infrastructure that runs them. 

Amazon ECS Managed Instances is another fully managed compute option. It automatically provisions, manages, and scales EC2 instances within your ECS cluster, including patching and lifecycle management, while keeping the instances visible in your AWS account.

Amazon ECS Managed Instances follow Amazon EC2 service quotas.

Amazon ECS Anywhere lets you register external instances, such as on-premises servers or virtual machines, with an ECS cluster.

With ECS on AWS Outposts, container instances run on Outposts EC2 capacity while the ECS control plane remains in the AWS cloud.

Amazon ECS Express Mode provides a simplified deployment experience that automatically creates and configures the ECS service, task definition, networking, load balancer, and auto-scaling, and supplies a default domain. By default, it uses AWS Fargate and an Application Load Balancer, with the resources created in your AWS account.

It supports various application architectures including microservices, batch processing, and machine learning and is versatile enough to support various application needs, from long-running applications to intermittent batch jobs. This makes ECS a highly effective platform for deploying a wide variety of applications, providing developers and IT teams the flexibility and tools they need to deliver robust, scalable applications.

Learn Amazon Elastic Container Service (Amazon ECS) in lessons

28 short lessons on Amazon Elastic Container Service (Amazon ECS) in 9 certification courses.

and 22 more lessons

Open the lessons

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.