AWS Fargate Pricing: Cost, Calculation, & Some Tips to Optimize Costs

Posted on

AWS Fargate Pricing – AWS Fargate is a service that makes it easy to run containers on AWS. Containers are used for everything from building applications to managing data, and they can be used in conjunction with other AWS services like ECS or Elastic Beanstalk. The benefit of using Fargate is that it reduces the operational overhead associated with running containers in production environments by eliminating the need for provisioning infrastructure, which can take days or weeks depending on how much horsepower you need. That’s why this article will teach you everything you need to know about using Fargate with containers: what it actually is, how it works, and how much it costs! By the end of this post you should have all the info necessary to start optimizing your own AWS usage so that costs stay low while your app continues running smoothly

What is AWS Fargate

Fargate is a service that allows you to run containers without having to manage servers or clusters. It’s based on EC2 Container Service (ECS) and Elastic Container Service for Kubernetes (EKS). With Fargate, you don’t have to worry about scaling your container clusters up or down as demand increases or decreases. AWS handles it all for you automatically—and even scales faster than you can request!

AWS Fargate pricing model

RegionLinux/X86Linux/ARMWindows/X86
US West (Northern California)per vCPU per hour $0.04656 $0.03725 $0.10523
per GB per hour$0.00511$0.00409$0.01155
OS license fee – per vCPU per hour$0.046
US East (Ohio)per vCPU per hour $0.04048 $0.03238 $0.09148
per GB per hour$0.004445$0.00356$0.01005
OS license fee – per vCPU per hour$0.046

AWS Fargate pricing model is based on the following four parameters:

  • CPU resources: The number of virtual CPU cores that you need for your container instances and how long they run. The prices vary from $0.10 to $1.50 per vCPU-hour, depending on the region where you want to run your containers. You can estimate this cost by multiplying your number of vCPUs by their hourly rate in USD/instance-hour multiplied by 86400 (the number of seconds in a day).
  • Memory resources: The amount of RAM available for each container instance when running at full utilization (e.g., 1 vCPU running at 100% utilization). Prices range from $0.02 per GB per hour in us-east-1a to $0.042 per GB per hour in us-west-2a; pricing varies by region but tends to be lower than CPU prices because memory doesn’t get as hot as CPUs do under heavy load.* Time running: This is charged based on how many minutes a particular instance runs during an hour (or how many hours an instance has been up), so if you have two instances with 4GB and 6GB respectively, but one started 20 minutes ago while another started 30 minutes ago, only the latter will incur any charges for that hour; however both will incur charges for their respective durations.* Storage: AWS Fargate pricing includes storage for containers via Amazon Elastic Block Store (EBS), which is priced at $0b2/TB/month plus provisioned IOPS costs ranging from $0b6/10K IOPS ($6k) up through $0b8/10M IOPS ($80k). Additional costs include EBS snapshots ($3-$9 per snapshot depending on size), data transfer outbound from EBS volumes ($0-$12 US dollars depending on volume size), access control list changes ($1-$5 depending on whether it’s adding or removing ACL rules

1. CPU resources:

The number of vCPUs and the frequency at which they operate determine how much computation is available to your cluster. The CPU resources are measured in different units:

  • vCPUs (virtual CPUs): A virtual CPU (vCPU) is a single, processor-like device that exists in a virtual machine and can be used for processing. They are similar to physical CPUs but have some limitations. For example, the vCPU doesn’t need to be homogeneous with other CPUs on a given host because it’s treated as an independent entity. It can also be allocated more than one physical core.
  • MHz (mhz): MHz stands for megahertz, which is one million cycles per second; it’s used to describe clock speed of processors or computers in general. By definition 1 GHz=1000 MHz, but newer systems may use higher values such as 2 GHz or 3 GHz .

2. Memory resources

The memory resources are measured in gigabytes (GBs). The amount of memory used per hour is calculated by adding the size of all deployed applications and containers together. A $0.05 per GB per hour charge is applied for each deployed application or container.

3. Time running

You can also retrieve the time that has elapsed on a task. This is useful in situations where you are waiting for something to complete, such as a batch process or an action that requires user input.

  • aws fargate get-task-time (prefix) [–max value]*

This command retrieves the amount of time that has elapsed since inception for a specific task on your Fargate cluster. You can optionally specify how many values should be returned by setting –max value , where value is an integer between 1 and 1000 (inclusive). If this option isn’t specified, then all values will be returned in ascending order (i.e., earliest first).

4. Storage

There are four ways to pay for storage:

  • By the GB – You’ll be charged for each GB you use. This is the most common way people pay and it’s easy to understand. Most people will find this option ideal since there are no surprises and the bill always matches what they expect.
  • By the hour – You’ll be charged based on how long your Fargate containers are running each month (up to 24 hours), regardless of how much data you store in them or how much time they spend idle during that period. If your container runs more than 24 hours per month, you’ll still only be charged by hour-based billing. This allows users who have very bursty usage patterns (e.g., high CPU requirements) an affordable way to use Fargate without worrying about exceeding expensive egress limits associated with getting billed by GBs used within a given month period alone.”

5. Additional costs

  • Network charges
  • Storage charges (ebs)
  • Data transfer charges

How to calculate AWS Fargate costs?

To calculate the total cost of your Fargate tasks, you can use the AWS Pricing Calculator.

  • In the calculator, choose “EC2 (Amazon EC2)” in the “Instance Type” drop-down menu.
  • Select “Fargate” in the “Launch Type” drop-down menu.
  • Enter your chosen AMI ID in “AMI”.
  • Enter your chosen CPU, memory and storage values as well as any additional block device options if required in either “Instance Details” or “Storage Details” fields depending on whether you want to add extra features during deployment or not (e.g., bootable volume). You may need to update these settings from time to time so make sure they match what is actually being used by instances!

1. CPU charges

Your CPU charges are calculated based on the number of vCPUs you use. The vCPU rate is $0.00001667/vCPU/hour and each additional vCPU adds about $0.000004167 to your bill for the month. If your account uses 10 vCPUs for one hour, then your CPU charge will be $0.001667 (100 – 10 x $0.0000166).

2. Memory charges

  • Memory charges are based on the memory capacity of the instance type.
  • Memory is charged at a per-second rate for each vCPU, and at a per-second rate for each GB of memory.

3. Ephemeral storage charges 

Ephemeral storage is the amount of disk space that is allocated to your container. The price per GB per month varies depending on whether you use EBS optimized AMIs or whether you’re using non-EBS optimized AMIs.

If you don’t use all the ephemeral storage in your container, AWS will charge you for it anyway. To avoid paying for un-used ephemeral storage, we recommend using EBS optimized AMIs (instead of regular AMIs).

4. Monthly Fargate compute charges

The compute charges are calculated based on the number of vCPUs and GB used in a month.

The monthly compute charges are calculated as the total number of vCPUs multiplied by the vCPU-hour charge.

The monthly compute charges are calculated as the total number of GB multiplied by the GB-hour charge.

Tips to optimize your Fargate costs and usage

There are a few ways you can optimize your Fargate costs and usage.

  • Use the Multiple Load Balancer Target Group feature. This is an excellent way to split traffic between multiple pools of containers that serve different functions, such as one pool for the web frontend and another pool for backend services.
  • Right-size Fargate tasks. Make sure that your container’s CPU and memory requirements are set appropriately so that there’s no wasted capacity or unnecessary scaling up of resources when only a small portion of them need it. Also, consider using spot instances to keep costs down when demand is low but also make sure you’re using sufficient capacity in case demand spikes suddenly (or at least enough so that CPU utilization doesn’t go above 50%).
  • Use resource tagging if possible; otherwise, take advantage of Auto Scaling by setting up alarms based on metrics such as CPU utilization and memory percentage used within each pod group/container instance group combination so that AWS will automatically scale up/down as needed—this can save you money!

1. Fargate Spot

Fargate is a spot market for EC2 instances. It’s a great way to reduce costs by taking advantage of unused capacity in Amazon’s overall infrastructure, and it also allows you to run workloads that have low utilization.

But, like any other market, there are certain risk factors associated with using it. In this article we’ll go over some of those risks as well as how they impact your ability to manage them and mitigate them.

2. AWS Savings Plans


On-Demand Pricing
1-year termAll Upfront payment3-year termAll Upfront payment
per vCPU per hour$0.04656$0.0363168(22% savings)$0.0246768(47% savings)
per GB per hour$0.00511$0.0039858(22% savings)$0.0027083(47% savings)

AWS offers a new set of plans called the AWS Savings Plans that allow you to save money when purchasing resources from the platform. These plans are meant for companies looking for regular, predictable cloud consumption with a certain level of predictability.

The Savings Plans are best suited for those who can commit to a monthly recurring charge and can have their workloads in production by the start of each month. If you don’t meet these criteria, you may want to look into other options such as Reserved Instances or Spot Instances (see section 1).

There are two types of savings plans:

  • Capacity-based: This option allows you to pay based on your actual usage instead of capacity purchased. You get access to discounted rates if your usage is below what was purchased in advance; however, if you exceed this predetermined amount then AWS will charge at standard rates.
  • Standard reservations: If your workloads aren’t actively running during off hours (i.e., weekends or holidays), then this plan might be right for you because it doesn’t require any activity from users during those times so long as they have enough reserved capacity available when needed later down the line!

3. Right-Sizing Fargate tasks

Right-sizing Fargate tasks

To explain what this means, let’s look at an example: You have an application with 100 containers and each needs to run for 10 minutes. If you launch all 100 containers at once, your cluster will be busy running them for the next 10 minutes. After that time has elapsed, the containers will be stopped and waiting for another 10 minute period to begin running again. This isn’t ideal because it means that some tasks may take longer than they need to while others are unnecessarily short. Instead of launching all 100 containers at once, we should right-size our tasks by breaking them up into several smaller jobs that run sequentially instead of simultaneously (see Figure 1).

4. Auto Scaling

Auto Scaling is a feature that allows you to scale your AWS Fargate tasks automatically based on specific triggers. You can configure autoscaling to scale up or down based on CPU, memory, network or storage metrics. For example:

  • If the average CPU utilization of a task exceeds 80% for five minutes, then increase the number of tasks by one
  • If the average number of running tasks drops below 20%, then terminate some existing task instances

4.1 Scheduled autoscaling

Autoscaling is a feature that allows you to automatically scale your application’s resources based on the load on your application. It’s useful, but requires some basic setup before it can be used effectively. After you’ve set up autoscaling, you can use CloudWatch alarms and scaling policies to trigger automatic changes in capacity when certain conditions are met.

CloudWatch metrics provide insight into how an AWS service is performing over time and can help you monitor the performance of various components within an application stack, including the underlying hardware or virtual machines (VMs). You can collect metrics from CloudWatch Logs or from other sources connected to your account, such as Amazon RDS for MySQL or Amazon EC2 Auto Scaling Groups (ASGs). A single metric value indicates whether something went wrong with your AWS resource—for example, if there was too much latency in accessing data stored on S3 buckets due to network congestion during peak hours would be reflected by high latency values being reported across multiple buckets using that particular storage class type

4.2 Target tracking

Target tracking is a way to scale your application based on the load of a particular component. As we discussed earlier, there are many other ways to scale your application, but target tracking is one of the most commonly used methods. It uses the metrics you specify to scale your application.

Target tracking is great if you have a burst of traffic and need more resources quickly. For example, if you’re using it for an e-commerce site selling goods online and suddenly get an influx of traffic when you’re not expecting it (maybe word has spread about some amazing new product or discount), then target tracking allows for fast scaling as well as making sure that no single user receives poor performance because they’re sharing resources with too many users at once.

4.3 Step scheduling

With Fargate, you can specify a start time for your tasks. When you set the schedule, you tell AWS how long to wait before starting the container. For example, if you want a task to start at 10:00 PM every night, you would create a schedule that starts at 10:00 PM and runs until 11:59 PM. In this case, the task will run from midnight (11:59 PM) until 5 minutes after midnight (12:05 AM).

5. Resource tagging

  • Resource tagging is used to identify a resource, describe it and associate it with another resource. For example, if you have two images of the same person but one is cropped by 25%, the image having more pixels would be tagged as high resolution.
  • Resource tagging can also be used to classify resources into different categories based on certain characteristics like color or size etc. This helps you in grouping similar resources together so that they can be easily identified when needed and thus make management easier for your team members.

6. Use the Multiple Load Balancer Target Group feature

  • Use the Multiple Load Balancer Target Group feature
  • Optimize costs by using the Multiple Load Balancer Target Group feature.

Use cases for optimized AWS Fargate pricing

If you have a workload that has little or no idle time, AWS Fargate can be an excellent choice. For example, if your application is designed to use a particular CPU for only a small portion of its lifetime, it might be more cost-effective for you to run this application on Fargate than on other EC2 instance types. This is also true if your application’s CPU requirement fluctuates widely over time, as this could lead to savings in reserved capacity fees.

Another common use case is large workloads optimized for low overhead. If your application needs high levels of memory (such as tens or hundreds of gigabytes), but consumes few CPU cycles compared with those used by larger instances such as E2 or R3 instances (for example), then using Fargate may make sense because it offers lower prices per GB than other instance families.

Finally, if you have occasional bursts in resource demand—such as when an array of instances fires up during peak demand times—you can also save money by using smaller AWS Fargate tasks instead of running them directly on larger EC2 instances; once the cloud burst passes and demand subsides again, these tasks will shut down automatically without incurring additional expenses from AWS unless they’ve been left running longer than expected.

1. Workloads that have little or no idle time,

  • Workloads that have little or no idle time

AWS Fargate is a good fit for workloads that have little or no idle time, such as services that require continuous availability and real-time access to resources. If you need to run your application 24/7 with high availability, use AWS Fargate.

  • Workloads that have occasional bursts of activity

You can also use AWS Fargate for applications with occasional bursts of activity, such as web servers or other web applications that only need to handle a limited amount of load at any given moment in time (for example, during peak hours). This is because AWS Fargate automatically scales up the number of EC2 instances in response to increases in demand and then scales down once these peaks are over so you don’t pay for unused capacity.

  • Workloads with occasional spikes in CPU usage

2. Large workloads optimized for low overhead

AWS Fargate is optimized for large workloads that have a low overhead. If you have large workloads and don’t need them to run 24/7, then AWS Fargate is the right choice for you.

3. Small workloads with occasional bursts

Small workloads with occasional bursts

Fargate is a good fit for workloads that do not require the compute power of a cluster. Fargate also works well as an addition to an existing cluster. It’s a great choice for running tasks like data processing, ETL and batch processing, especially when those tasks are run periodically. If your application needs to scale quickly from time to time, you may be able to use Fargate without any additional cost or management overhead since the billing system can be tailored to handle varying usage patterns.

4. Tiny/microscale workloads

  • Tiny/microscale workloads

You may run a small workload in a container and want to use the smallest possible container size. For example, if you want to run a small database on a laptop or desktop and don’t need persistent storage or full Docker support, then you can use the tiny runtime.

5. Batch workloads

Batch workloads are ideal for Fargate. They are long-running and do not require CPU or memory resources, which means that they can be scheduled to run when there is spare capacity in your cluster.

This includes tasks such as ETL (extract, transform and load), batch processing of data sets, bulk file uploads, video transcoding and much more.

Going Forth

AWS Fargate is a good service to run containers. It’s an alternative to AWS EC2, which means that you can use it instead of EC2, if you want. Fargate allows you to run your containers without having to worry about the infrastructure underneath them—you just set up your container and go!

aws fargate is a good service to run containers

AWS Fargate is a service that makes it easy to run containers on AWS. It handles all of the cluster management, task scheduling, and resource allocation for you. You simply define how many instances of your container should run at any given time, and Fargate takes care of the rest by requesting resources from ECS clusters or creating new ones.

You can attach any Docker image as an input to your task definition without worrying about whether it will be compatible with ECS or not because Fargate only works with Docker images that are already supported by ECS itself (e.g., Amazon Linux).

Conclusion

In this article, we have explained what is Fargate and how to use it. We have covered the pricing model, cost calculation, tips for optimizing your costs and usage and also some use cases for optimized AWS Fargate pricing.

In addition, we have discussed some common pitfalls that you should avoid when using this service. The main takeaway from this article should be that Amazon Web Services (AWS) Fargate is a good service to run containers on; however, it’s not perfect so you need to be careful when using it.

Hurry Up!