How can I get the size of an Amazon S3 bucket?

The AWS CLI now supports the –query parameter which takes a JMESPath expressions. This means you can sum the size values given by list-objects using sum(Contents[].Size) and count like length(Contents[]). This can be be run using the official AWS CLI as below and was introduced in Feb 2014 aws s3api list-objects –bucket BUCKETNAME –output json … Read more

AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden

I figured it out. I had an error in my cloud formation template that was creating the EC2 instances. As a result, the EC2 instances that were trying to access the above code deploy buckets, were in different regions (not us-west-2). It seems like the access policies on the buckets (owned by Amazon) only allow … Read more