0
0
AWScloud~30 mins

Lambda pricing model in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Lambda Pricing Model Calculation
📖 Scenario: You are working as a cloud engineer for a startup. Your team wants to estimate the monthly cost of using AWS Lambda functions based on the number of requests and the duration of each request. AWS Lambda pricing depends on the number of requests and the compute time in GB-seconds.
🎯 Goal: Build a simple AWS Lambda pricing calculator that takes the number of requests and average duration per request, then calculates the total monthly cost.
📋 What You'll Learn
Create variables for the number of requests and average duration in milliseconds
Add configuration variables for free tier limits and pricing rates
Calculate the total compute time in GB-seconds
Calculate the total monthly cost including free tier deductions
💡 Why This Matters
🌍 Real World
Estimating AWS Lambda costs helps startups and developers manage cloud expenses effectively.
💼 Career
Cloud engineers and architects often calculate service costs to optimize budgets and design cost-efficient solutions.
Progress0 / 4 steps
1
Set up initial usage data
Create two variables: number_of_requests set to 1000000 and average_duration_ms set to 200 representing the number of Lambda requests and average duration in milliseconds.
AWS
Need a hint?

Use simple assignment to create the two variables with the exact names and values.

2
Add pricing configuration variables
Add three variables: free_tier_requests set to 1000000, free_tier_gb_seconds set to 400000, and price_per_million_requests set to 0.20 representing the free tier limits and price per million requests.
AWS
Need a hint?

Define the three variables exactly as named with the given values.

3
Calculate total compute time in GB-seconds
Calculate the total compute time in GB-seconds and store it in total_gb_seconds. Assume each Lambda uses 1 GB of memory. Convert average_duration_ms to seconds and multiply by number_of_requests.
AWS
Need a hint?

Remember to convert milliseconds to seconds by dividing by 1000.

4
Calculate total monthly cost
Calculate the total monthly cost and store it in total_cost. Subtract the free tier limits from number_of_requests and total_gb_seconds (use max with 0 to avoid negatives). Calculate request cost by dividing billable requests by 1,000,000 and multiplying by price_per_million_requests. Assume compute cost is $0.00001667 per GB-second. Sum request cost and compute cost for total_cost.
AWS
Need a hint?

Use max to avoid negative billable amounts and multiply costs correctly.