Skip to main content

AWS Lambda Reserved Concurrency Versus Provisioned Concurrency

I hold AWS Certified SysOps Administrator, AWS Certified Developer, and AWS Certified Solutions Architect certifications.

Reserved concurrency and provisional concurrency are Lambda concepts that may come up on the AWS Developer Associate certification exam

Reserved concurrency and provisional concurrency are Lambda concepts that may come up on the AWS Developer Associate certification exam

While preparing for the AWS Certified Developer - Associate certification exam, you may come across Lambda-related questions in practice tests that have both reserved concurrency and provisioned concurrency as options. For the exam, it's important to be able to tell them apart, so you can eliminate the one that serves as a distractor. Unfortunately, the AWS descriptions are confusing, making it harder to remember which is which.

This is how the AWS documentation describes reserved concurrency:

Reserved concurrency guarantees the maximum number of concurrent instances for the function. When a function has reserved concurrency, no other function can use that concurrency.

And this is how the AWS documentation describes provisioned concurrency:

Provisioned concurrency initializes a requested number of execution environments so that they are prepared to respond immediately to your function's invocations.

Comparing each of these concepts to something else may make it easier to remember which is which.

  • Envelope Encryption in AWS KMS Made Easy
    If you are preparing to take the AWS Certified Developer Associate (DVA-C01) certification exam, it is important to understand how envelope encryption using KMS and Customer Master Keys works

Reserved Concurrency

To better understand what reserved concurrency is, think of throwing a birthday party for a child. Twenty kids are attending the party and you have forty mini cupcakes. If you place all forty mini cupcakes on a big plate for the kids to help themselves, some may take 4 or 5 leaving other kids with none at all. To avoid having disappointed children, you set aside, or reserve, two cupcakes per child.

Compare this to the AWS description of Lambda Reserved Concurrency:

Reserved concurrency guarantees the maximum number of concurrent instances for the function.

Scroll to Continue

Just like reserving cupcakes guarantees the maximum number of cupcakes each child gets, reserved concurrency in Lambda guarantees that each individual function can't have more concurrent instances than what you reserve.

Why might reserving concurrency be necessary?

It may be necessary because of AWS service limits or quotas.* Lambda has a default concurrency limit of 1000 across all functions per region in each account. If you have ten Lambda functions running in the US-East-1 region, all ten have to share that default concurrency limit of 1000. Using reserved concurrency, you can determine how many concurrent instances each Lambda function can have. According to AWS, "there is no charge for configuring reserved concurrency for a function."

* Each AWS account has default quotas, formerly known as limits, for each AWS service. Most quotas are Region-specific. You can submit a request for increases to some quotas. Other quotas are fixed and cannot be increased.

You can reserve concurrency for AWS Lambda functions

You can reserve concurrency for AWS Lambda functions

Provisioned Concurrency

To better understand provisioned concurrency, think of operating a restaurant that offers food delivery. Each afternoon between 2 pm and 4 pm is a slow period for your business. You only get a few orders per month between these hours, so you don't schedule any delivery people. On the rare occasions that you receive an order, you have to call one of your delivery employees to come in to work to make the delivery. These food orders take much longer than normal which leads to customer complaints. To keep your customers happy, you decide to have a delivery person on standby between 2 pm and 4 pm even though they usually have nothing to do. That way, if a rare order comes in between 2 pm and 4 pm, they are ready to go.

Let's look at the AWS description of provisioned concurrency again:

Provisioned concurrency initializes a requested number of execution environments so that they are prepared to respond immediately to your function's invocations.

Just like a food delivery person is always available to respond immediately, a Lambda function is always available to respond immediately. Since provisioned concurrency runs continuously, you will be charged to use it.

Why might provisioned concurrency be necessary?

If a lambda function hasn't been used for a while or if it has been updated, new execution environments are created. Executing a Lambda function involves steps like installing function code and starting the runtime. Because initialization can take time, there may be some latency. This latency is often referred to as a cold start. To avoid having a cold start, you can provision concurrency to keep functions initialized. According to AWS, provisioned concurrency "keeps functions initialized and hyper-ready to respond in double-digit milliseconds."

You are billed for using AWS Lambda provisioned concurrency

You are billed for using AWS Lambda provisioned concurrency

This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.

© 2022 LT Wright

Related Articles