AWS Lambda Provisioned Concurrency: Auto Scaling

Try 2 types of Auto Scaling - based on schedule and based on the utilization for your business. See how you can save money while using AWS Lambda Provisioned Concurrency

For companies, AWS Lambda cold starts are a huge and frustrating problem nowadays. Who doesn’t want their clients to navigate quickly through their apps and websites and their employees or programs to work faster? Here comes the AWS Lambda Provisioned Concurrency as a solution to the problem. But with the activation of Provisioned Concurrency, the question about pricing arises. In this article, we will talk about how to save money while using AWS Lambda Provisioned Concurrency and more specifically about Auto Scaling. Let’s start with a brief review of Provisioned Concurrency first. 

Provisioned Concurrency is a new way to avoid cold starts by keeping a certain number of “pre-warmed” execution environments.  Keep in mind that such a feature can be expensive if used when unnecessary. So how do you save money AND have Provisioned Concurrency? The Auto Scaling comes to your aid! Auto Scaling allows you to increase the number of warm environments just for the necessary moments of time. For example, there is a food delivery company N, which gets most of the orders during breakfast, lunchtime, and at 6 pm. Here they’ll need Auto Scaling in Provisioned Concurrency to keep up with the orders faster and more efficiently. 

The service allows you to build scaling plans for resources, including Amazon ECS tasks, Amazon Aurora Replicas, Amazon EC2 instances, Spot Fleets, and Amazon DynamoDB indexes and tables.

If you are using Amazon EC2 Auto Scaling, now you are able to combine it with AWS Auto Scaling for scaling extra resources for more AWS technologies.

Benefits of Auto Scaling

  • Organize Scaling quickly
  • Keep up performance automatically
  • Pay only for what you need
  • Make smart scaling choices

Auto Scaling can be divided into:

  • Scheduled Auto Scaling
  • Workload Auto Scaling (based on utilization)

Scheduled Auto Scaling

Scheduled Auto Scaling chart

Scheduled Auto Scaling is used when boosts of request rates are mostly predictable. Let’s take a simple example of a company, where employees work from 9 to 5, so request rates will be higher during this time.

Benefits of Scheduled Auto Scaling:

  • Saves money by scheduling Provisioned Concurrency for a fixed amount of time instead of being active all the time
  • Saves time and extra efforts by scheduling Provisioned Concurrency automatically

Workload Auto Scaling

Workload Auto Scaling chart

Workload Auto Scaling is based on measured utilization and used when request rates are not really predictable. Provisioned Concurrency here will match the change of workload.

Benefits of Workload Auto Scaling:

  • Saves time spent on manual Provisioned Concurrency settings as the Provisioned Concurrency will match the number of requests
  • Saves money by automatically fitting according to the workload when it is unpredictable for setting the Provisioned Concurrency beforehand

How to manage a Lambda Provisioned Concurrency Configuration via Terraform

Example Usage with Alias Name

resource "aws_lambda_provisioned_concurrency_config" "this" {
  function_name                     = aws_lambda_function.this.function_name
  provisioned_concurrent_executions = var.provisioned_concurrent_executions
  qualifier                         = aws_lambda_alias.this.name
}

The following arguments are required:

  • function_name - (Required) Name or Amazon Resource Name (ARN) of the Lambda Function.
  • provisioned_concurrent_executions - (Required) Amount of capacity to allocate. Must be greater than or equal to 1.
  • qualifier - (Required) Lambda Function version or Lambda Alias name.

Auto Scaling and you

Auto Scaling pricing chart

Auto Scaling will save huge amounts of your money while using AWS Lambda Provisioned Concurrency. Let’s look at the chart above. If the capacity is large and growing, the billing duration for on-demand Lambdas increases respectively. So, if your system is highly loaded, the usage of Provisioned Concurrency positively influences price as billing duration decreases. It is a very efficient solution. If you would like to get more information on that or get your project with AWS Lambda Provisioned Concurrency, contact us and our experts will gladly help you.


Connect with our experts Let's talk