Skip to content

Instantly share code, notes, and snippets.

@cfclrk
Last active April 4, 2017 13:00
Show Gist options
  • Save cfclrk/78f94885f5bc6b66c475eb199d3ed968 to your computer and use it in GitHub Desktop.
Save cfclrk/78f94885f5bc6b66c475eb199d3ed968 to your computer and use it in GitHub Desktop.
Example of using a botocore waiter
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