Giter VIP home page Giter VIP logo

Comments (13)

nonspecialist avatar nonspecialist commented on May 12, 2024 8

Okay, I figured it out ... I hope this issue (and comment) helps others.

The correct syntax is:

[{"parameter_key":"ExampleParameter","parameter_value":"1234"}]

If you need to supply multiple parameters, the syntax is:

[ {"parameter_key":"Param1","parameter_value":"1234"},{"parameter_key":"Param2","parameter_value":"1234"} ]

This did my head in for a while.

from aws-cli.

pputnik avatar pputnik commented on May 12, 2024 8

hi All,
Any improvement here since 2013? Any way to use '--parameters file:///...' instead of list of parameters?
Thank you.

from aws-cli.

onetom avatar onetom commented on May 12, 2024 3

I see it's possible to have some abbreviation, like:

--parameters ParameterKey=Vpc,ParameterValue=vpc-1f616a7d ParameterKey=SubnetA,ParameterValue=subnet-44e1e926 ParameterKey=SubnetB,ParameterValue=subnet-36d8f342

but that's still pretty ugly compared to

--parameters Vpc=vpc-1f616a7d, SubnetA=subnet-44e1e926, SubnetB=subnet-36d8f342

and it's especially annoying, since u have to specify these again when u r doing an aws cloudformation update-stack ...

from aws-cli.

gnaresh19 avatar gnaresh19 commented on May 12, 2024 2

Any update on the above request to use '--parameters file:///...' instead of list of parameters ?

Thanks!

from aws-cli.

nonspecialist avatar nonspecialist commented on May 12, 2024

Further information: running with --debug shows me that even though parameters are getting parsed in the forms which work, none of them are being sent in the POST.

(I also notice that I left out two closing braces in the template ... sorry for the transcription error)

snippets from --debug:

...
2013-02-19 16:41:30,558 - botocore.parameters - DEBUG - name: Parameters
2013-02-19 16:41:30,558 - botocore.parameters - DEBUG - label: 
...
send: 'POST / HTTP/1.1\r\nHost: cloudformation.us-east-1.amazonaws.com\r\nAccept-Encoding: identity\r\nContent-Length: 529\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: AWS4-HMAC-SHA256 Credential=xxxxxxxxxxxxx/20130219/us-east-1/cloudformation/aws4_request, SignedHeaders=host;user-agent;x-amz-date, Signature=xxxxxxxx\r\nX-Amz-Date: 20130219T054130Z\r\nUser-Agent: aws-cli/0.5.3 Python/2.7.3 Linux/3.7.6-102.fc17.x86_64\r\n\r\nStackName=example&Action=CreateStack&Version=2010-05-15&TemplateBody=%7B%22AWSTemplateFormatVersion%22%3A%222010-09-09%22%2C%22Description%22%3A%22Example+template%22%2C%22Parameters%22%3A%7B%22ExampleParameter%22%3A%7B%22Type%22%3A%22Number%22%7D%7D%2C%22Resources%22%3A%7B%22ExampleVolume%22%3A%7B%22Properties%22%3A%7B%22AvailabilityZone%22%3A%22us-east-1a%22%2C%22Size%22%3A%2210%22%2C%22Tags%22%3A%5B%7B%22FirstTag%22%3A%7B%22Ref%22%3A%22ExampleParameter%22%7D%7D%5D%7D%2C%22Type%22%3A%22AWS%3A%3AEC2%3A%3AVolume%22%7D%7D%7D'
reply: 'HTTP/1.1 400 Bad Request\r\n'

from aws-cli.

garnaat avatar garnaat commented on May 12, 2024

Thanks for your diligence 8^) We acknowledge that the actual format of complex parameters is currently difficult to decipher. We are working on a couple of ways to improve this. I'll update this ticket when this work has been completed.

from aws-cli.

tomstockton avatar tomstockton commented on May 12, 2024

What's the correct syntax for passing the parameters on the command line rather than as a 'file:'?

from aws-cli.

nonspecialist avatar nonspecialist commented on May 12, 2024

Hi Tom,

The syntax for command-line use is the same; using a file: prefix just makes it pull the contents from a file instead of from stdin. Of course, this may present some interesting challenges with quoting, shell metacharacters, and so on but for the most part it's straightforward.

Example:

$ aws cloudformation create-stack --stack-name my-test-stack \
    --template-body file:my-template.json \
    --parameters '[{"parameter_key":"KeyName","parameter_value":"my-ssh-keyname"}]'

from aws-cli.

tomstockton avatar tomstockton commented on May 12, 2024

Thanks for that, I was trying to wrap the JSON list in single quoted braces. Didn't think to just single quote the list.

I'm having more fun now!

from aws-cli.

sebsto avatar sebsto commented on May 12, 2024

What is the new syntax these days ?
I just tried the syntax described by @nonspecialist above but it seems it does not work anymore

I am using

$ aws --version
aws-cli/0.16.0 Python/2.7.2 Darwin/12.4.0
$ pip list | grep boto
boto (2.11.0)
botocore (0.16.0)

I tested this format

[{"parameter_key":"name", "parameter_value":"test"}]

And received

Invalid value ('parameter_key') for param element of list:Parameters of type list

from aws-cli.

adrianmeca avatar adrianmeca commented on May 12, 2024

I just run into the same issue, now the format seems to be [{"ParameterKey":"name", "ParameterValue":"test"}]

For the single quote I believe that with a single note on the official documentation or the help command will do: "Note: for the json sintax single quote the json string" it would save lots of headaches

from aws-cli.

onetom avatar onetom commented on May 12, 2024

Why is it necessary to specify a hash of ParameterKey and ParameterValue instead of creating the hash directly?
{ "name": "value", "instance": "i-03fa8d" }
is a lot more readable than
[ {"ParameterKey": "name", "ParameterValue": "test"}, {"ParameterKey": "instance", "ParameterValue": "i-03fa8d"} ]

from aws-cli.

garnaat avatar garnaat commented on May 12, 2024

See #484. This is being actively worked and we hope to have an improved UI available for map-like values in the future.

from aws-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.