tiayush
tiayush

Reputation: 3

AWS get content using aws CLI

I have an s3 object which stores a JSON file. Is there a way that I can fetch that object and store its content in a variable to perform JSON operations like getting value for key etc. using AWS cli.

Upvotes: 0

Views: 1005

Answers (1)

jellycsc
jellycsc

Reputation: 12259

Of course, you can do something like this in shell:

$ x=`aws s3 cp s3://bucketName/key -`
$ echo $x
{ "checked": false, "dimensions": { "width": 5, "height": 10 }, "id": 1, "name": "A green door", "price": 12.5, "tags": [ "home", "green" ] }

This key part of this cli command is the - at the end. It tells the command to write the output to stdout instead of a file.

Upvotes: 2

Related Questions