Bird
Raised Fist0
AWScloud~20 mins

Lambda pricing model in AWS - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Lambda Pricing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding AWS Lambda Pricing Components

Which of the following factors directly affect the cost of running an AWS Lambda function?

AThe number of requests and the duration of each execution measured in milliseconds.
BThe size of the deployment package and the number of environment variables used.
CThe number of concurrent executions and the size of the Lambda function's memory allocation.
DThe AWS region and the number of API Gateway endpoints connected.
Attempts:
2 left
💡 Hint

Think about what AWS charges for when you invoke a Lambda function.

❓ service_behavior
intermediate
2:00remaining
Effect of Memory Allocation on Lambda Cost

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?

AThe cost per invocation doubles because memory increased four times but duration halves.
BThe cost per invocation stays the same because duration is unchanged.
CThe cost per invocation quadruples because memory increased four times.
DThe cost per invocation increases linearly with memory size and duration.
Attempts:
2 left
💡 Hint

Remember that cost depends on both memory size and execution time.

❓ Architecture
advanced
2:00remaining
Optimizing Lambda Cost with Execution Duration

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?

ACost remains the same because duration halves and memory doubles.
BCost doubles because memory doubles despite duration halving.
CCost halves because duration halves despite memory doubling.
DCost quadruples because memory doubles and duration halves.
Attempts:
2 left
💡 Hint

Calculate cost as memory size times duration.

❓ security
advanced
2:00remaining
Impact of Lambda Provisioned Concurrency on Pricing

Which statement correctly describes how enabling Provisioned Concurrency affects AWS Lambda pricing?

AProvisioned Concurrency only affects cold start times and does not change pricing.
BYou pay a fixed hourly rate for the provisioned concurrency plus the usual request and duration charges.
CProvisioned Concurrency eliminates duration charges but increases request charges.
DProvisioned Concurrency replaces the request charges with a flat monthly fee.
Attempts:
2 left
💡 Hint

Think about what extra resource is reserved when you enable Provisioned Concurrency.

✅ Best Practice
expert
3:00remaining
Choosing Memory Size for Cost Efficiency

You want to minimize AWS Lambda cost for a function that runs variable workloads. Which approach best balances cost and performance?

ASet memory to the lowest possible value to minimize cost per millisecond, accepting longer execution times.
BSet memory high enough to reduce execution time significantly, even if cost per millisecond is higher.
CRandomly adjust memory size and monitor costs without analyzing execution time.
DUse a memory size that results in the lowest total cost, considering both memory and execution time together.
Attempts:
2 left
💡 Hint

Think about total cost = memory size * execution duration.

Practice

(1/5)
1. What two main factors determine the cost of an AWS Lambda function?
easy
A. Number of requests and compute time
B. Storage size and network bandwidth
C. Number of users and API calls
D. Memory size and database queries

Solution

  1. Step 1: Understand AWS Lambda pricing basics

    AWS Lambda charges based on how many times your function runs (requests) and how long it runs (compute time).
  2. Step 2: Identify the pricing factors

    Memory size affects compute time cost but the main factors are requests and compute time.
  3. Final Answer:

    Number of requests and compute time -> Option A
  4. Quick Check:

    Requests + compute time = cost [OK]
Hint: Remember: pay for calls and duration only [OK]
Common Mistakes:
  • Confusing storage or bandwidth as pricing factors
  • Thinking memory size alone determines cost
  • Mixing API calls with requests
2. Which of the following is the correct way to express AWS Lambda pricing units?
easy
A. Memory in MB and network packets
B. Requests per hour and CPU cycles
C. Number of requests and GB-seconds
D. Storage in GB and function calls

Solution

  1. Step 1: Recall AWS Lambda pricing units

    Lambda pricing is based on number of requests and compute time measured in GB-seconds (memory size x execution time).
  2. Step 2: Match correct units

    Requests count how many times function runs; GB-seconds measure memory used over time.
  3. Final Answer:

    Number of requests and GB-seconds -> Option C
  4. Quick Check:

    Requests + GB-seconds = pricing units [OK]
Hint: Think requests and memory-time units [OK]
Common Mistakes:
  • Using CPU cycles or network packets incorrectly
  • Confusing storage with compute time
  • Mixing units like MB with packets
3. If a Lambda function runs 1,000,000 times with 512 MB memory for 1 second each, which factor mainly increases the cost?
medium
A. Execution time of 1 second per request
B. Network bandwidth used by the function
C. Memory size doubling from 256 MB to 512 MB
D. Number of requests being 1,000,000

Solution

  1. Step 1: Understand cost components

    Cost depends on requests and GB-seconds (memory size x execution time x requests).
  2. Step 2: Analyze impact of memory size

    Doubling memory from 256 MB to 512 MB doubles GB-seconds, increasing cost significantly, but the number of requests (1,000,000) is the main driver of total cost.
  3. Final Answer:

    Number of requests being 1,000,000 -> Option D
  4. Quick Check:

    Requests x GB-seconds = total cost [OK]
Hint: Number of requests greatly impacts total cost [OK]
Common Mistakes:
  • Ignoring number of requests effect
  • Thinking network bandwidth affects Lambda cost
  • Assuming execution time or memory alone drives cost
4. A developer notices their Lambda cost is higher than expected. They set memory to 1024 MB but function runs only 100 ms. What is the likely issue?
medium
A. Memory size is too high for short execution time
B. Number of requests is too low
C. Function execution time is too long
D. Free tier is not applied to this function

Solution

  1. Step 1: Review memory and execution time relation

    Cost depends on memory size multiplied by execution time. High memory with short time still costs more than lower memory.
  2. Step 2: Identify cost cause

    Setting memory to 1024 MB increases GB-seconds cost even if function runs only 100 ms.
  3. Final Answer:

    Memory size is too high for short execution time -> Option A
  4. Quick Check:

    High memory + short time can increase cost [OK]
Hint: High memory with short run still costs more [OK]
Common Mistakes:
  • Assuming short execution time always means low cost
  • Ignoring memory size impact
  • Thinking free tier always applies
5. A company uses Lambda functions with 256 MB memory running 200 ms per request. They want to reduce cost without changing code. Which approach helps most?
hard
A. Switch to EC2 instances for better pricing
B. Reduce memory size to 128 MB if function still runs correctly
C. Increase number of requests to use free tier fully
D. Increase memory size to reduce execution time

Solution

  1. Step 1: Understand cost relation to memory and time

    Cost = requests x memory size x execution time. Reducing memory lowers GB-seconds cost if function still works.
  2. Step 2: Evaluate options

    Reducing memory to 128 MB saves cost if performance is acceptable. Increasing memory or requests raises cost. Switching to EC2 is a different model and may not be cheaper.
  3. Final Answer:

    Reduce memory size to 128 MB if function still runs correctly -> Option B
  4. Quick Check:

    Lower memory reduces GB-seconds cost [OK]
Hint: Lower memory if function still works to save cost [OK]
Common Mistakes:
  • Increasing memory without checking cost impact
  • Thinking more requests reduce cost
  • Assuming EC2 always cheaper than Lambda
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard