It would be useful if the aws sns publish
command allowed stdin for the --message
, which would aid easily creating a dynamic message e.g., from piping the output of another command.
In case it helps others, one workaround in the meantime is to use something like xargs
. For example:
echo 'Hello world.' | xargs -I {} aws sns publish ... --message "{}"
@bwbaugh
Out of curiosity, is there a specific scenario that you had in mind that xargs
does not handle for piping output as input to the CLI? Or is this more of a convenience feature (so you would not have to use xargs
)?
I think it was more for convenience than anything else i.e., I forgot about xargs
until I had to think of another way to use the output of another command. I haven't ran into an issue yet where quotes interfered with the use of xargs
, but maybe that's also a potential issue?
Another workaround is to assign the value to a variable (if you're writing a shell script) and then do aws sns publish ... --message "${foo}"
. Since there are several workarounds, this is probably pretty low priority (just nice to have for convenience).
Yep I like using both of those of those methods when I am stringing together commands in a shell.
Since there is a fair amount of alternatives, I will leave this issue open as feature request open for a little bit to see if anyone else has a similar request. If it does not gain too much traction, I will probably close it in a week or two (but it will still be able to be reopened if traction is gained much later after it is closed).
I agree reading the message from stdin would be a nice feature. Misquoting is a frequent source of bash bugs. Some more concrete reasons to pass it via stdin:
SNS supports messages up to 256KB, but I don't think you can pass that much data as an argument (at least not portably, although it sounds like it would work on recent Linux).
It makes your ps listings more "noisy".
The message may contain sensitive data you don't want to appear in a ps listing.
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.
Looks like this is already possible with a command like: aws sns publish ... --message file:///dev/stdin
Most helpful comment
I agree reading the message from stdin would be a nice feature. Misquoting is a frequent source of bash bugs. Some more concrete reasons to pass it via stdin:
SNS supports messages up to 256KB, but I don't think you can pass that much data as an argument (at least not portably, although it sounds like it would work on recent Linux).
It makes your ps listings more "noisy".
The message may contain sensitive data you don't want to appear in a ps listing.