Trigger lambda with 15 min delay

0

I like to automate the flowing process whenever an AMI is created with certain name i want to startup a intance from that AMI for that i used cloudwatch rule to obtain the api call from cloudtrail and used lambda for creating the instance But when it causes a error that snapshot it not ready(it take few minutes to snapshot to be available) So i want to trigger the lambda 15 min after the api call arised in trail. What is the most suitable way to do this

2 Answers
2

Have you considered using Step Functions? One of the workflow states is "wait": https://docs.aws.amazon.com/step-functions/latest/dg/state-wait.html - after waiting you could then trigger the Lambda function.

profile pictureAWS
EXPERT
answered a month ago
EXPERT
reviewed a month ago
profile picture
EXPERT
reviewed a month ago
1

Hello,

When the state of an Amazon Machine Image (AMI) changes, Amazon EC2 generates an event that is sent to Amazon EventBridge. The events are sent to the default EventBridge event bus in JSON format. You can use Amazon EventBridge to detect and react to these events. You do this by creating rules in EventBridge that trigger an action in response to an event. For example, you can create an EventBridge rule that detects when the AMI creation process has completed and then invokes an Amazon SNS topic to send an email notification to you.

You can get detail from this link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-ami-events.html

profile pictureAWS
SUPPORT ENGINEER
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • This solution is better because it will only trigger when the AMI has been created and is complete.l and you won’t need your delay and the snapshot will be complete. Don’t use cloud watch rules. Use event bridge rule

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions