Created
February 15, 2023 00:24
-
-
Save samjarrett/0301661b089d061afe1666356f279d55 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
import argparse | |
import yaml | |
import boto3 | |
CLOUDFORMATION = boto3.client("cloudformation") | |
def main(): | |
parser = argparse.ArgumentParser(prog="convert_parameters") | |
parser.add_argument("stack_name") | |
parser.add_argument("output_file", type=argparse.FileType("w")) | |
args = parser.parse_args() | |
stack = CLOUDFORMATION.describe_stacks(StackName=args.stack_name)["Stacks"][0] | |
params = { | |
parameter["ParameterKey"]: parameter["ParameterValue"] | |
for parameter in stack["Parameters"] | |
} | |
print("---", file=args.output_file) | |
yaml.dump(params, args.output_file) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment