In v1 it was working as expected. After updating to v2 the command aws cloudfront create-invalidation --distribution-id ID_HERE --paths /*
after successful finish awaits for user input.
This issue makes chaining it with other commands impossible (in bash scripts for example). Here's the screen share video demonstrating the issue. I have to press Q
on a keyboard to exit and continue.
Hi @MEGApixel23 ,
This is not an error, but the expected result, the command reference explains this and also a way to avoid it and instead get a file created with the output:
...the AWS CLI automatically generated a random CallerReference. To specify your own CallerReference, or to avoid passing the invalidation parameters as command line arguments, you can use a JSON file. The following example creates an invalidation for two files, by providing the invalidation parameters in a JSON file named inv-batch.json:
aws cloudfront create-invalidation \ --distribution-id EDFDVBD6EXAMPLE \ --invalidation-batch file://inv-batch.json
The file inv-batch.json is a JSON document in the current folder...
Hope this helps
@KaibaLopez thank you for a quick response!
I've changed --paths
parameter to --invalidation-batch
parameter per documentation and the full command looks like this now:
aws cloudfront create-invalidation --distribution-id XXXXXX --invalidation-batch file://invalidation-batch.json
Here is a content of invalidation-batch.json
file:
{
"Paths": {
"Quantity": 1,
"Items": [
"/*"
]
},
"CallerReference": "cli-example"
}
However, after the command is finished it still waits for user input and I cannot proceed in the console.
Here is a screen share demonstrating the issue. Note the (END)
at the end of the input. It won't let me continue until I press Q
on my keyboard (just like exit Vim command):
https://www.dropbox.com/s/45hgx67e34w523q/Screen%20Recording%202020-02-19%20at%2012.13.32.mov?dl=0
Hmm yea,
Alright, I'll mark this a feature request, since the exact behavior on this is not specified I don't think it qualifies as a bug (this looks like an expected behavior), but I can see why it'd be useful to at least have an option for it to not wait for the input.
In the mean time you can always pipe shell commands to avoid these situations, for example you could "throw away" the out put by typing:
aws cloudfront create-invalidation --distribution-id XXXXXX --invalidation-batch file://invalidation-batch.json | > /dev/null
Thanks for pointing it out!
Thank you for a workaround, that worked for now.
However, after re-pointing output to an external source I had to change my deployment scripts which were using aws cloudfront create-invalidation
command's output as input parameters. Also, I had to adapt it for deployment from Windows machines since there is no /dev/null
there.
Not a big deal, but this can be considered as a breaking change and I think it's useful to mention it in a v1 to v2 migration guide if there is such. Again, in v1 it was not waiting for user input and output the result in the console).
Thanks for your help again! 馃
Hi @MEGApixel23 ,
I asked around and this is a change the team made because the cli is trying to move towards a more interactive experience.
good news is it is configurable, here's the documentation with the instructions.
@KaibaLopez Thank you again for your help!
For some reason setting the following configuration in ~/.aws/config
file
[default]
cli_pager=
didn't work. However, adding AWS_PAGER=""
in front of the aws cli command did the trick!
Closing the issue now.
Most helpful comment
@KaibaLopez Thank you again for your help!
For some reason setting the following configuration in
~/.aws/config
filedidn't work. However, adding
AWS_PAGER=""
in front of the aws cli command did the trick!Closing the issue now.