Created
May 18, 2020 17:14
-
-
Save ashutoshkarna03/6cef24007c609b8c613fb31ecdbbee01 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 stop_instance(instance_id, client): | |
waiter = client.get_waiter('instance_stopped') | |
# call stop_instances to stop the instance | |
response = client.stop_instances(InstanceIds=[instance_id], DryRun=False) | |
# waiter waits until the stop operation is complete | |
print('Stopping instance, this may take few minutes...') | |
waiter.wait(InstanceIds=[instance_id,], DryRun=False) | |
return dict(success=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment