If you allocated 512MB of memory to your function, executed it 4 million times in one month, and it ran for 1 second each time, your charges would be calculated as follows:
Monthly compute charges
The monthly compute price is $0.00001667 per GB-s and the free tier provides 400,000 GB-s.
Total compute (seconds) =4M * (1s) = 4,000,000 seconds
Total compute (GB-s) = 4,000,000 * 512MB/1024 = 2,000,000 GB-s
Total compute – Free tier compute = Monthly billable compute GB- s
2,000,000 GB-s – 400,000 free tier GB-s = 1,600,000 GB-s
Monthly compute charges = 1,600,000 * $0.00001667 = $26.67
Monthly request charges
The monthly request price is $0.20 per 1 million requests and the free tier provides 1M requests per month.
Total requests – Free tier requests = Monthly billable requests
4M requests – 1M free tier requests = 3M Monthly billable requests
Monthly request charges = 3M * $0.2/M = $0.60
Total monthly charges
Total charges = Compute charges + Request charges = $26.67 + $0.60 = $27.27 per month
https://aws.amazon.com/lambda/pricing/