Amazon ECS is a fully managed container orchestration service that makes running, stopping, and managing containers on a cluster easy. Yet while Amazon ECS (Elastic Container Service) provides a scalable way to run containerized applications, understanding its pricing model can be challenging.
While ECS itself has no additional charges, the services you use with it — like EC2 instances, Amazon EBS volumes, or Fargate virtual CPUs — generate costs. Knowing the ins and outs of these pricing structures is essential for optimizing spend.
In this practical guide, we’ll break down Amazon ECS pricing: the key factors that determine cost, how to save on ECS, and what tools are available to help you monitor and optimize expenses.
What is Amazon Elastic Container Service (Amazon ECS)?
Amazon ECS is a proprietary Amazon Web Services (AWS) container management service that provides an efficient and secure way to run and scale containerized applications on AWS infrastructure. ECS is deeply integrated with AWS services, providing a seamless experience for AWS users.
ECS is designed for simplicity and getting started quickly, with the inherent trade-off of offering less fine-tuned control and flexibility compared to more complex services like Elastic Kubernetes Service (EKS). With ECS, there’s no need to manage a control plane, nodes, or add-ons. ECS is advantageous for quick deployments or when a more basic and straightforward approach suffices.
It’s also worth noting that with ECS you don’t have to pay for a control plane, meaning that it can potentially be cheaper than EKS.
What are the Amazon ECS pricing models?
When it comes to Amazon ECS pricing, there are four models to consider.
EC2 Launch Type: With EC2 Launch Type, you manage the underlying instances running your containers, paying for the EC2 instances based on their type and usage.
Fargate Launch Type: Fargate Launch Type abstracts the infrastructure management, charging you based on the CPU utilization and memory resources your containers use without needing to manage EC2 instances.
ECS Anywhere: ECS Anywhere extends ECS to your on-premises infrastructure, allowing you to manage containers across hybrid environments while paying only for the control plane.
ECS on AWS Outposts: ECS on AWS Outposts runs containerized applications locally in your own data center using AWS infrastructure, with pricing based on the Outposts configuration and the AWS resources you provision.
Let’s take a look at each model in more detail.
#1: EC2 Launch Type
Amazon Elastic Compute Cloud (EC2) Launch Type provides the most control over your infrastructure. You can select, configure, and manage the EC2 instances running your containers, allowing you to optimize for specific performance requirements, instance types, and pricing models, such as Reserved Instances or Spot Instances.
There are five ways to pay for EC2 instances:
On-Demand Instances: Pay by the second or hour with no long-term commitment, offering flexibility but typically at a higher cost.
Spot Instances: Purchase unused EC2 capacity at a significantly lower price, ideal for fault-tolerant workloads, but instances can be interrupted.
Reserved Instances (RI): Commit to a 1- or 3-year term for a lower price, providing savings in exchange for long-term usage commitments.
Savings Plans: Flexible pricing model that offers savings for committing to a consistent amount of compute usage (measured in dollars per hour) over a 1- or 3-year term, covering multiple instance types and services like Fargate.
Dedicated Hosts: Pay for a physical server exclusively for your use, giving you more control over instance placement and compliance requirements.
Here are a few tips to keep in mind about costs when using EC2 launch type:
- You choose and manage the instance types and sizes. To save, select EC2 instance types that closely match your workload requirements and right size instances as your workloads evolve.
- You pay for EC2 instances as long as they run, so stop or terminate idle instances to avoid overpaying.
- Monitor and scale based on demand by leveraging Auto Scaling to dynamically adjust the number of EC2 instances in use.
- Leverage discounts like Reserved Instances or Savings Plans for long-running and predictable workloads, and Spot instances for stateless or fault-tolerant workloads.
If you find juggling pricing plans and Spot to be a hassle, you’re not alone. With nOps, users don’t have to worry about provisioning the right infrastructure when deploying a workload or scaling an application — nOps automatically provisions the optimal blend of Spot, Reserved Instances and Savings Plans for performance and stability and backs you with a 100% utilization guarantee. - Keep an eye on EBS volume usage and data transfer, as these can add up quickly; use appropriate storage types and minimize inter-region traffic to control costs.
#2: AWS Fargate Launch Type
Fargate Launch Type offers a serverless approach to running containers, eliminating the need to manage the underlying infrastructure. Instead of provisioning and managing EC2 instances, Fargate automatically allocates the necessary resources for your containers, allowing you to focus solely on your applications while AWS handles the scaling and infrastructure management.
Fargate pricing is based entirely on the CPU and memory resources your containers use. You only pay for the exact resources consumed by your workloads, making it cost-efficient for applications with variable or unpredictable resource needs.
The five components of Fargate Launch Type pricing
Fargate Launch Type pricing depends upon:
- vCPU Usage: Fargate charges for the amount of virtual CPU (vCPU) allocated to your tasks and services. Pricing is based on the exact number of vCPUs you assign to your containers, and you are billed per second for the duration they are running until the Amazon ECS task terminates.
- Memory Usage: Similar to vCPU, Fargate pricing includes the memory allocated to your containers. You are billed based on the amount of memory your Amazon ECS task requires, with charges also being calculated per second of usage.
- Operating System: Fargate supports both Linux and Windows containers.
- CPU Architecture: Fargate supports both X86 and ARM architectures.
- Storage: If your tasks require ephemeral storage (temporary storage during task execution), Fargate charges based on the volume of storage used, adding another layer to the overall pricing.
Fargate Launch Type Pricing example
Imagine you have a service that runs 5 ECS Tasks for 10 minutes (600 seconds) each day for 30 days. Each task uses 1 vCPU, 2GB of memory, and 30GB of ephemeral storage. Using the Linux/x86 pricing for the US East (N. Virginia) Region, where vCPU costs $0.000011244 per second, memory costs $0.000001235 per GB per second, and ephemeral storage costs $0.0000000308 per GB per second:
- Monthly CPU charges:
5 Tasks x 1 vCPU x $0.000011244 x 600 seconds x 30 days = $1.01 - Monthly memory charges:
5 Tasks x 2GB x $0.000001235 x 600 seconds x 30 days = $0.22 - Monthly ephemeral storage charges:
You get 20GB of storage for free, so for the additional 10GB:
5 Tasks x 10GB x $0.0000000308 x 600 seconds x 30 days = $0.03 - Total monthly Fargate compute charges:
$1.01 (CPU) + $0.22 (memory) + $0.03 (storage) = $1.26
This makes the total cost for running your tasks $1.26 per month with AWS ECS Fargate Launch type.
#3: ECS Anywhere
ECS Anywhere extends Amazon ECS to your on-premises infrastructure, allowing you to manage containers across hybrid environments. This option is typically used by those who have significantly invested in an on-premises datacenter or regulatory requirements that mandate maintaining control over your infrastructure.
With ECS Anywhere, you have no upfront commitments or minimum fees—you’re charged for the time your on-premises instances are registered and connected to the ECS control plane.
Calculating pricing for ECS Anywhere
You pay $0.01025 per hour for each on-premises instance that is registered with an ECS cluster and managed by ECS Anywhere. Each of these instances is self-managed and must be registered with an Amazon ECS cluster while running the Amazon ECS container agent. Charges are based on the total time the instance is connected to the ECS control plane, rounded up to the nearest second.
In addition to the hourly rate, there are a few additional charges to keep in mind:
- You may incur costs if you register more than 1000 instances with AWS Systems Manager Agent per account, per region.
- Data transfer fees may apply if the Amazon ECS control plane communicates with the ECS agent via VPN or Direct Connect. Open Internet communication incurs no data transfer fees.
Free Tier: ECS Anywhere offers a free tier of 2200 instance hours per month for six months, giving you an opportunity to explore and scale without immediate costs.
ECS Anywhere Pricing Example:
If you’re managing 100 on-premises instances with ECS Anywhere, and each instance is connected for 50 hours and 1 minute, your total fee would be calculated as:
100 instances x ($0.01025 per hour x 50 hours + 1 minute / 60 minutes x $0.01025) = 100 x ($0.5125 + $0.00017) = $51.27 for 50 hours and 1 minute of use.
#4: ECS on AWS Outposts
ECS on AWS Outposts Pricing Structure:
You can purchase Outposts with various EC2 instance configurations, storage options, and payment plans. The available payment options include All Upfront, Partial Upfront, or No Upfront, with pricing applied over a 3-year term.
- All Upfront: Pay the full cost at the start of the term.
- Partial Upfront: Pay a portion upfront and the rest in monthly installments.
- No Upfront: Spread the entire cost in monthly payments over the 3-year term.
EC2 Instance and Storage Costs
Optimize ECS costs with nOps
Are you already running containers and looking to automate your workloads at the lowest costs and highest reliability?
nOps Compute Copilot helps engineering teams automatically optimize any compute-based workload. It intelligently provisions all of your compute, integrating with your AWS-native ECS, EKS (Cluster Autoscaler or Karpenter), Batch or ASGs to automatically select the best blend of SP, RI and Spot.
- Less management overhead. By automating time-consuming manual tasks like selecting instances, picking pricing plans and continually tuning your existing auto scaling solution, nOps frees engineers to focus on building and innovating.
- Effortless Spot savings. Copilot empowers you to run many more workloads safely on Spot, for greater savings and less manual effort. It continually and proactively moves your workloads onto diverse instance types, with the same SLAs as Amazon’s On Demand.
- 100% Commitment Utilization Guarantee. nOps fully manages all of your Savings Plans and Reserved Instances so you have the most flexibility and least risk — we guarantee 100% utilization, or we will refund you anything you don’t use.