What the New 1ms AWS Lambda Pricing Means

The serverless community received exciting news at this month’s virtual re:Invent when AWS announced Lambda would now bill by the millisecond (ms). Prior to the announcement, Lambda was billed per 100ms. 

Under the previous billing structure, if you had a function that only ran for 50ms, you would still be billed for the full 100ms. With the new pricing, that same function would cost 50 percent less. You’ll see even greater savings on functions that only run for 20ms, which will cost 80 percent less.

Here are just a few examples of how 1ms billing will impact particular functions compared to 100ms billing:

Function Duration: 46.12 ms

  • Previous billing duration: 100 ms
  • New billing duration: 47 ms

Function Duration: 123.02 ms

  • Previous billing duration: 200 ms
  • New billing duration: 124 ms

Why Does the Pricing Change Matter?

The switch to 1ms billing is a major advancement for cost management in serverless applications. With this change, the serverless community is one step closer to actualizing the ‘pay only for what you use’ promise.

We expect two key trends to emerge as more users take full advantage of the new pricing:

  1. The popularity of faster, lighter languages such as Rust and Go will increase as AWS users look to maximize their cost savings.
  2. AWS users will focus more attention on optimizing functions that run less than 100ms, because they can now achieve significant cost savings by doing so. We’ll be updating our 10 Tips to Manage Your AWS Serverless Costs to reflect this shift.

How Can I Reduce My Own Serverless Costs?

Our top 10 tips for managing AWS serverless costs is a great place to start (see link above). Here are a few additional tips:

  • If you have any common processes across your function, you can use a Lambda layer to optimize your application package and reduce execution time. Move your common processes to your Lambda layer and run only what you actually need to process for that function.
  • Depending on the situation, you might consider increasing memory size (which will also increase your Lambda’s CPU) to reduce execution time. Although the unit price based on execution time will increase, the total price could decrease due the shortened execution time.