Creating Scheduled Tasks With AWS Lambda
Scheduled tasks can be used for many different reasons. Some examples include:
- Aggregating statistics
- Monitoring the status of a system
- Automating simple periodic tasks
- Indexing data
- Sending notifications to end-users, other systems, or third-parties
AWS Lambda is a service that lets you run code without managing servers. When you use Lambda you pay only for the computing time you consume, it's often the most cost-effective solution for short, frequent computing tasks.
When using scheduled invocations of Lambda functions, apart from configuring the function itself, you don't have to create any other infrastructure to run your function.
Amazon EventBridge is a serverless event bus service that allows you to connect different services and applications. EventBridge has many use cases of which event scheduling is just one.
Amazon CloudWatch is a monitoring and observability service that allows you to view logs and graphs of your AWS services. You can use CloudWatch to observe your Lambda functions running when you want them to as well as their health.
In this Lab, you will create a Lambda function. You will learn how to configure EventBridge to create a schedule that invokes your Lambda function on schedule. Finally, you will verify that your Lambda function is being triggered using CloudWatch.
Upon completion of this Lab, you will be able to:
- Create Lambda functions
- Run Lambda functions on a schedule using EventBridge
- Monitor Lambda functions using CloudWatch
This is a beginner-level lab intended for:
- Cloud Engineers
You should have a conceptual understanding of:
- Event-based communication
- Serverless functions
- Monitoring and Observability
Experience with the following AWS services will be helpful but is not required:
The Understanding AWS Lambda to Run & Scale Your Code course can be used to fulfill the Lambda prerequisite.
May 31st, 2023 - Updated instructions to utilize EventBridge Scheduler
December 2nd, 2022 - Updated the instructions and screenshots to reflect the latest UI
May 11, 2022 - Updated the instructions and screenshots to reflect the latest UI
February 7th, 2022 - Updated the instructions and screenshots to reflect the latest UI
March 9th, 2021 - Updated AWS Lambda instructions to reflect the latest user-interface changes
May 6th, 2020 - Updated all Instructions and screenshots. Migrated from CloudWatch Events to EventBridge
January 10th, 2019 - Added a validation Lab Step to check the work you perform in the Lab
Andrew is a Labs Developer with previous experience in the Internet Service Provider, Audio Streaming, and CryptoCurrency industries. He has also been a DevOps Engineer and enjoys working with CI/CD and Kubernetes.
He holds multiple AWS certifications including Solutions Architect Associate and Professional.