- Newest
- Most votes
- Most comments
Hello,
You can make use of the EventBridge in order to schedule the lambda function to run every month using a cron expression.
You can configure an event bridge rule that will schedule the lambda function to run every month to obtain the CPU metrics of your EC2 instance. This can be done by following the below steps:
➞ Open the Functions page on the Lambda console and choose the lambda function.
➞ Under Function Overview, click on Add trigger.
➞ Set the trigger type to EventBridge (CloudWatch Events).
➞ For Rule, select Create a new rule, and then provide the rule name and rule description.
➞ For rule type, choose Schedule expression.
➞ In the Schedule expression field, enter a cron expression. For example, to run the function at 8 AM UTC on the first day of every month, you can use cron(0 8 1 * ? *)
You can find more information on how to write cron expressions in the below document:
Please note that you would have to configure the lambda function code such that it is able to obtain the CPU usages of the EC2 instance.
Relevant content
- asked 2 years ago
- asked 24 days ago
- asked 7 months ago
- AWS OFFICIALUpdated 9 days ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a month ago