- Newest
- Most votes
- Most comments
Depending on some numbers using a Lambda might be worth it. Assumptions:
- A month has 2629800 seconds.
- You can use the cheapest Lambda for checks (128 MB), which costs 0.000001666675 per second + 0.0000002 per call in the cheapest regions (official docs).
Tuis the time you take to detect updates.Tcis the time between checks (lambda executions).
Your monthly cost for using Lambdas will be Tu * 0.000001666675 * (2629800 / Tc) + (2629800 / Tc) * 0.0000002 = (4.383Tu + 0.526)/Tc
You don't have much control over Tu, although you can optimize the function to be quicker. Let's assume you're using something like Python and each check takes 200 ms. Now you have: Cost = 1.4/Tc
If you accept making checks every second, we are talking about 1.4 USD / month, which is cheaper than any on demand EC2 instance in the cheapest regions. If you need quicker checks, having a very small EC2 instance such as the t4g.nano turned on 24/7 costs about 3 USD per month, again, in the cheapest regions. So it all depends on your definition of near-real-time updates.
answered 3 years ago
You may want to use the Amazon EventBridge service to create a rule to schedule the execution of the Lambda function, which pings the API to fetch the data. Amazon EventBridge is a managed service for building event-driven applications. It costs only $1.00/million invocations per month after the initial 14 million free invocations per month. So it is very cheap than running and maintaining an EC2 instance.
You can also use AWS Step Functions to orchestrate the Lambda functions to build a workflow.
For more information, refer https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-run-lambda-schedule.html
answered 3 years ago
Relevant content
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago

I appreciate your advice! This is very helpful!