Structure parameters is what I think I’m missing.
Thanks alot for the info. Really helps understand how to figure things out.
Looks like there’s also a shorthand but JSON will work too
This is a good trick so you can write out your objects multi-line
--provisioned-throughput '{"ReadCapacityUnits":15,"WriteCapacityUnits":10}' \
--table-name MyDDBTable```
Those slashes at the end of the lines basically say the next line is actually part of this line
So you can write your script or whatever legibly
Ahh, I guess I’m looking for examples like this for actions in cli documentation but it doesn’t necessarily always exist. Just have to go find it else where like you mentioned
Definitely learning new CLI commands and APIs is always a little bit of bashing your head against the wall until you figure out the exact syntax. Some documentation is better than others and as you work with more calls with the same cli/API it gets easier
Honestly I highly recommend to do stuff like this in Ansible, python, or ruby because you get so many more programmatic tools and syntactic sugars to make it easier to work with APIs and complex clis
Maybe powershell has a similar amount of that but it’s ugly and I hate it even though I work with it too
For something like this with Ansible I would probably use a J2 template for the structure of the table request, stick my variables and maybe conditions on parameters if needed in there, and then load the template into a var to pass into the cli in a separate command, so I can parameterize the template to work for all of my use cases, environments, etc
You can do the same with Python as well (jinja2 is a Python thing I think)
googling j2 template lol
It’s a super powerful templating syntax that you can use for basically any type of markup you want to make…html pages, JSON objects, etc
And it gives you access to things like if and loops, and evaluating variables and expressions within the template during run time
So you can very flexibly build out many complex things with one template as long as they can follow the same patterns
A good example you could use this with would be cloud formation templates or Azure resource Manager JSON objects
So instead of having a very static JSON file for your cloud formation resource you can have a cool template that works for every case you want to create that resource across your project
hmm, I need to do a tutorial on this. I’m not quite seeing the value add over CloudFormation mapping.