Serverless costs

Costs of a serverless application

Unlike traditional hosting, serverless hosting is billed based on usage. This means that you only pay for what you use, down to the request.

To be clear, this means that if your application is not used, you don't pay anything.

On AWS Lambda, you pay for:

  • the number of requests
  • the duration of the requests (the time it takes to execute your code)

There are no costs when the PHP application is waiting between requests (or jobs, events, etc.). It doesn't matter if AWS Lambda scaled your functions up to several instances (containers), you only pay for the requests and the duration of the requests.

For some use cases it has interesting consequences: 1 job running for 10 minutes has about the same costs as 600 jobs running for 1 second in parallel.

Costs calculator

Use the calculator below to estimate the costs of running your PHP application serverless on AWS Lambda.


HTTP backend (assets excluded)

Website assets

Asynchronous jobs

Database (MySQL or PostgreSQL)

Monthly costs (free tier included)

Assumptions: 1024MB of memory (Bref default config) and ARM CPUs.
Assumptions: API Gateway v2. Lambda Function URL could be used instead of API Gateway to reduce costs.

Total AWS costs

The calculator takes into account the AWS free tier (except the free tier that expires after 12 months). It uses prices for the us-east-1 region. Other regions can have slightly higher costs (a few percents usually).
Costs can vary at scale and can be optimized in numerous ways. For a cost-optimized architecture tailored to your needs, get in touch.