Notify when AMI available

旧街凉风 提交于 2021-02-11 14:00:11

问题


anyone know how to synchronously call AWS Lambda when my new AMI is available? I'd like emphasize that I'm interested in AMI's available state, not just pending. Basically I'm looking for something like RDS Event for EC2.

Flow: CreateAMIAPICall --> AMI ami-abc123 is beeing created (pending) --> AMI ami-abc123 is available --> ? --> TRIGGER AWS LAMBDA


回答1:


You did not state the language you are using in Lambda, but boto3 has the capability!

From EC2 — Boto 3 Docs:

waiter = client.get_waiter('image_available')

Polls EC2.Client.describe_images() every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.




回答2:


There isn't an event type like this which is generated when CreateImage is called and subsequently a new AMI becomes ready to use

You'll just have to poll for the state with DescribeImages



来源:https://stackoverflow.com/questions/51704471/notify-when-ami-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!