Which of the following factors directly affect the cost of running an AWS Lambda function?
Think about what AWS charges for when you invoke a Lambda function.
AWS Lambda pricing is based on the number of requests and the duration of execution, which depends on the allocated memory and execution time. The deployment package size and environment variables do not affect pricing directly.
You have a Lambda function that runs for 1 second. You increase its memory from 128 MB to 512 MB. How does this change affect the cost per invocation?
Remember that cost depends on both memory size and execution time.
Cost is calculated as memory size (in GB) multiplied by execution duration (in seconds). Increasing memory from 128 MB to 512 MB is a 4x increase, so cost per invocation quadruples if duration stays the same.
You have a Lambda function that processes data in 2 seconds with 256 MB memory. You optimize the code to run in 1 second but need 512 MB memory to do so. What is the impact on cost per invocation?
Calculate cost as memory size times duration.
Cost = memory (GB) * duration (seconds). Doubling memory and halving duration results in the same cost.
Which statement correctly describes how enabling Provisioned Concurrency affects AWS Lambda pricing?
Think about what extra resource is reserved when you enable Provisioned Concurrency.
Provisioned Concurrency reserves execution environments, so you pay an hourly fee for that reservation in addition to normal request and duration charges.
You want to minimize AWS Lambda cost for a function that runs variable workloads. Which approach best balances cost and performance?
Think about total cost = memory size * execution duration.
The best practice is to find the memory size that minimizes the product of memory and execution time, not just the lowest memory or fastest execution alone.