Using Amazon’s CLI is handy, quick and often preferable to going through the Console. I wanted a way to read billing information from the command-line without having to log into AWS.
Exporting billing information to an S3 bucket is not the scope of this article. (Here is an article to help with that.) The goal here is to be able to read any text file (including billing files) in stdout.
Making a bucket is easy.
Verifying that the bucket exists and displaying its contents is also straightforward. Here we can see that our bucket is
We can copy a local file to the bucket using cp.
And finally, we can output to stdout by copying the file locally and sending the output to /dev/stdout. Note that since the target is stdout, the file is not copied to the local file system.