Categories
Computing

S3 Buckets: Create, Put, Read

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.

Screen Shot 2016-06-09 at 6.16.56 AM

Verifying that the bucket exists and displaying its contents is also straightforward. Here we can see that our bucket is

Screen Shot 2016-06-09 at 6.18.47 AM

We can copy a local file to the bucket using cp.

Screen Shot 2016-06-09 at 6.25.44 AM

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.

Screen Shot 2016-06-09 at 6.34.27 AM

 

Leave a Reply

Your email address will not be published. Required fields are marked *