Created
November 1, 2017 13:44
-
-
Save tomkukral/a8464d62bdee72fc1e6d585d55e6264f to your computer and use it in GitHub Desktop.
List CloudFormation stacks
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
| #!/usr/bin/env python3 | |
| import boto3 | |
| from pprint import pprint | |
| session = boto3.Session(profile_name='mi') | |
| client = session.client('cloudformation') | |
| stacks = client.describe_stacks() | |
| for stack in stacks['Stacks']: | |
| #pprint(stack) | |
| name = stack['StackName'] | |
| status = stack['StackStatus'] | |
| salt = '' | |
| created_at = stack['CreationTime'].isoformat() | |
| for output in stack['Outputs']: | |
| if output['OutputKey'] == 'SaltMasterIP': | |
| salt = output['OutputValue'] | |
| print(name, status, salt, created_at) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment