Last active
April 4, 2017 13:00
-
-
Save cfclrk/78f94885f5bc6b66c475eb199d3ed968 to your computer and use it in GitHub Desktop.
Example of using a botocore waiter
This file contains 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
import botocore.session | |
cloudformation_template = """ | |
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Resources": { | |
"queue1": { | |
"Type": "AWS::SQS::Queue", | |
"Properties": { | |
"QueueName": "my-queue" | |
} | |
} | |
} | |
} | |
""" | |
session = botocore.session.get_session() | |
cloudformation_client = session.create_client('cloudformation', region_name='us-east-1') | |
print('creating cloudformation stack') | |
cloudformation_client.create_stack(StackName='my-stack', TemplateBody=cloudformation_template) | |
print('waiting for cloudformation stack creation to complete') | |
waiter = cloudformation_client.get_waiter('stack_create_complete') | |
waiter.wait(StackName='my-stack') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment