Back to blog

AWS ECS Pricing: 4 Pricing Models and Best Practices

Alon Roitman

Channels and Cloud Alliances Lead, Intel Granulate

What Is AWS ECS? 

Amazon Elastic Container Service (ECS) is a cloud computing service by Amazon Web Services (AWS). It is a common alternative to Kubernetes, the leading container orchestration platform.

ECS enables developers to manage containers and run applications in the cloud without the need to set up and configure environments. The service manages groups of containers called clusters, with each server defined as a task, allowing DevOps teams to easily manage them using API calls. Amazon ECS can be managed and customized via the AWS Management Console and software development kits (SDKs).

This is part of a series of articles about Kubernetes costs.

In this article:

AWS ECS Pricing 

ECS is available to AWS users at no extra charge. You pay for the AWS resources created for storing and running your applications. There is no upfront commitment or minimum fee, so you only pay for the resources you use. 

AWS ECS Pricing with EC2

Amazon doesn’t charge extra to launch or run containers with EC2. You pay for the resources used to run the applications, including Elastic Block Store (EBS) volumes and EC2 instances. The AWS EC2 pricing page provides further information about prices.

While there are no upfront or minimum fees, EC2 does have drawbacks. When deploying an ECS container to an EC2 instance, you must define the instance type and specify when it should scale. The customer is responsible for provisioning, maintaining, monitoring, and securing all underlying instances. EC2 instances have a fixed size, so you should clearly know the container requirements to ensure you choose the right instance size. 

EC2 also has significant advantages. It provides greater control for customizing the infrastructure to match specific business and technical needs—for instance, you can choose between GPU-optimized and network-optimized instances. EC2 is often the most cost-effective cloud option, provided you choose the right containers.

https://granulate.io/gmaestro

AWS ECS Pricing with Fargate

AWS Fargate allows you to pay for your container-based applications’ memory and compute resources. However, it is slightly more expensive than EC2 because AWS handles the heavy lifting, including provisioning and managing underlying infrastructure or servers.

Amazon calculates Fargate pricing from when you pull container images until an ECS task finishes, rounded up to the nearest second. It also has a minimum charge (one minute). 

With Fargate, the EC2 bill covers:

  • The number of tasks run
  • The duration of the tasks
  • The number of vCPUs used for the tasks (per hour)
  • The memory used for the tasks (per GB-hour)

You might pay a premium for Fargate, but it lets developers focus on building and managing their applications. You specify the resources required for each EC2 task, and Fargate launches the relevant containers. It also enhances security by isolating applications by design.

AWS ECS on Outposts

AWS Outposts is a managed service from Amazon that extends AWS tools, infrastructure, services, and APIs to your on-premises environment. It lets you build and run your applications on a hybrid or non-cloud infrastructure.

Amazon ECS pricing on AWS Outposts is simple, using the same model as in the cloud. The ECS control plane remains in the cloud, not on Outposts, while the container instances run on Outposts using EC2 capacity with no extra charge. 

You can host the ECS containers on Outposts for use cases that require storing data on-premises or if your application has a low tolerance for latency. However, Outposts is often more expensive than other cloud-based compute options. The Outposts pricing page provides more details about AWS Outpost costs.

Pricing for AWS ECS Anywhere 

ECS Anywhere is an AWS ECS feature that lets you easily run container workloads on a self-managed infrastructure. It builds on the simplicity of ECS, providing consistent API and tooling experiences across all containerized applications. The workload scheduling, monitoring, and cluster management are the same in the cloud and on-premises.

Although you pay for all managed, running instances, ECS Anywhere does not have upfront or minimum charges. Each on-premise instance costs $0.01025 per hour—you manage these instances, but you must register each one with an ECS cluster to allow an ECS container agent to run it. 

The ECS Anywhere pricing page provides further information about charges.

Optimizing Amazon ECS Costs

Here are some tips to help optimize your costs on ECS:

Tag Your Resources

Tagging Amazon ECS resources like services, tasks, task definitions, container instances, and clusters is important for making these resources easier to manage. Tags help you accurately allocate costs, enhance workload visibility, and search your container-based applications. They are also useful for implementing programmatic infrastructure management and specifying granular permissions at the resource level. 

Managing the ECS costs and infrastructure without tags is more difficult, especially when distributed across multiple teams, environments, and products. 

Evaluating untagged resources across all environments and teams is important to help cut costs. Tagging can help you discover hidden running and orphaned resources that could drive up costs without your knowledge.

Create a Savings Plan

A compute savings plan can help you manage your ECS costs by leveraging discounts. This new, flexible savings model offers the same benefits as convertible reserved instances. AWS ECS with Fargate pricing calculates the memory and vCPU resources used from the download start time to the ECS task’s termination (rounded up to the nearest second). 

A savings plan can cut your AWS Fargate usage by up to half if you commit to a specified term (one or three years) or amount of usage. 

https://granulate.io/gmaestro

Use Spot Instances

Fargate Spot lets you cut ECS costs by up to 90% compared to on-demand instance pricing. Spot instances are useful for fault-tolerant tasks that you can parallelize. They also suit API and website tasks with high availability requirements. 

You can set a minimum number of tasks when configuring the service auto-scaling policy, specifying how many tasks must run at any given time. You can improve the service performance by adding tasks to Fargate Spot. 

Leverage-Auto-Scaling

The right configuration that allows auto-scaling policies for Fargate and ECS helps optimize costs. Auto-scaling prevents cluster services from scaling when unnecessary and improves cost efficiency. 

When fine-tuning the autoscale feature in the Fargate configuration, you must gauge the application’s performance baseline to evaluate its performance under load. After establishing the app’s performance profile, you can adjust the auto-scaling configuration for Fargate and ECS.

Related content: Read our guide to Kubernetes cost optimization (coming soon)

Learn more in our detailed guide to GKE pricing

Optimize application performance.

Save on cloud costs.

Start Now
Back to blog