Get parameters of CloudFormation stack

Get parameters of CloudFormation stack using Boto3

12

Votes

import boto3
import json
import sys

session = boto3.Session(profile_name=PROFILE_NAME_IF_NOT_USING_DEFAULT)
client = session.client('cloudformation')

def DescribeStack(stackName):
    response = client.describe_stacks(
        StackName=stackName
    )
    try:
        parameters = (response['Stacks'])[0]['Parameters']
        return (parameters)

    except KeyError:
        return("There are no parameters in this stack.")


if __name__ == '__main__':
    DescribeStack(*sys.argv[1:])

Vote Here

You must earn at least 1 vote on your snippets to be allowed to vote

Terms Of Use

Privacy Policy

Featured snippets are MIT license

Gears & Masters

Advertise

DevOpsnipp.com © 2020

medium.png