Aws-cli: Request for cloudformation/get-template to return original raw template

Created on 19 Oct 2013  路  10Comments  路  Source: aws/aws-cli

When I want to update a stack, I first need to download the current live template in use with the stack. The old cfn-* tools would return my original file, whereas the new aws tool instead returns a re-formatted json version of my original template.
I wish to have an original raw copy of the template so it would be easier to make changes.

cloudformation feature-request

Most helpful comment

Based on community feedback, we have decided to return feature requests to GitHub issues.

All 10 comments

:+1: would really like to see this but fixed but unsure how to go about it. boto returns a string of the template JSON as uploaded with create_stack or update_stack, aws-cli however re-parses that as JSON so when outputted is different.

Adding "--output text" doesn't do what I'd expect. Maybe there should be a "--output raw" option?

PS. my use case is I want to diff a "running template" against what I'm about to upload/update.

PPS. Even if I add the option "--query TemplateBody" the resulting JSON is reformatted. :(

Not very familiar with the code yet but looking at botocore's service-2.json for CloudFormation the TemplateBody "shape" is of type string rather than structure which at a guess should have some bearing on this.

Anyone got any ideas on how to approach fixing this?

What's the motivation behind keeping the exact same formatting? The format we use for JSON formatting is a very common pretty-printing format that you'll find in most languages and tools. Is there any reason to diverge from pretty-printing? Or maybe there's some other issue here I'm missing?

The template is a json file that we as users have to edit by hand. Pretty-printing / re-formatting it destroys all the work we put into its layout. diff with local versions are useless.

If I create/update a stack from a template then fetch the same template via the cli, the template returned is formatted completely differently to the one I uploaded. As a newbie that would be very concerning, for anyone else it means you need to do a structural json diff between the "local" template and the one returned by the cli.

The CloudFormation API itself returns the document exactly as uploaded, it's just the cli that reformats it.

It's not a deal breaker but is unexpected and I think undesirable behaviour.

I think something like --no-decode-template would work.

I believe the diff functionality as mentioned by @jimcroft is a valid usecase. Although you could argue to reformat the local file and compare this would work too :)

Strongly upvoting this request.

It's a useful validation to compare our structured, generated templates against the current one, which is painful currently when I have to select-copy-edit-paste it from the console. With a true original copy fetch in scripting (especially one from a stack which may have been recently deleted accidentally, therefore no longer available from the console), we can review the diff and confirm that the changes we made are what we wanted, without having to separately archive the template.

Good Morning!

We're closing this issue here on GitHub, as part of our migration to UserVoice for feature requests involving the AWS CLI.

This will let us get the most important features to you, by making it easier to search for and show support for the features you care the most about, without diluting the conversation with bug reports.

As a quick UserVoice primer (if not already familiar): after an idea is posted, people can vote on the ideas, and the product team will be responding directly to the most popular suggestions.

We鈥檝e imported existing feature requests from GitHub - Search for this issue there!

And don't worry, this issue will still exist on GitHub for posterity's sake. As it鈥檚 a text-only import of the original post into UserVoice, we鈥檒l still be keeping in mind the comments and discussion that already exist here on the GitHub issue.

GitHub will remain the channel for reporting bugs.

Once again, this issue can now be found by searching for the title on: https://aws.uservoice.com/forums/598381-aws-command-line-interface

-The AWS SDKs & Tools Team

Based on community feedback, we have decided to return feature requests to GitHub issues.

Was this page helpful?
0 / 5 - 0 ratings