Created
May 18, 2020 18:12
-
-
Save ashutoshkarna03/4f86a96e0244802980ad943d4a48bfd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_image_of_instance(instance_id, client): | |
waiter = client.get_waiter('image_available') | |
# call create_image to create AMI of given instance | |
response = client.create_image(InstanceId=instance_id, Name="latest-image-of-" + instance_id) | |
print('Creating image, this may take few minutes...') | |
waiter.wait(ImageIds=[response['ImageId']], DryRun=False) | |
return response['ImageId'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment