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 --query "[sum(Contents[].Size), length(Contents[])]"
Related Posts:
- AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden
- How can I resolve the error “The security token included in the request is invalid” when running aws iam upload-server-certificate?
- How can I use wildcards to `cp` a group of files with the AWS CLI
- AWS Lambda:The provided execution role does not have permissions to call DescribeNetworkInterfaces on EC2
- AWS – Disconnected : No supported authentication methods available (server sent :publickey)
- What is difference between Lightsail and EC2?
- What is the difference between Amazon SNS and Amazon SQS?
- AWS: What does 0.0.0.0/0 and ::/0 mean?
- What is the difference between Elastic Beanstalk and CloudFormation for a .NET project?
- DynamoDB – Key element does not match the schema
- How to improve paralelized computing in AWS EC2?
- Error “You must specify a region” when running any aws CLI command
- S3 Bucket action doesn’t apply to any resources
- 403 ERROR The request could not be satisfied
- AWS – Create a record set for an s3 static website
- AWS s3 api error: specified bucket does not exist
- Amazon Cloudfront with S3. Access Denied
- AWS RDS connection limits
- DynamoDB : The provided key element does not match the schema
- boto3 client NoRegionError: You must specify a region error only sometimes
- AWS lambda function error – Unable to import module ‘index’: Error
- What is the difference between Amazon ECS and Amazon EC2?
- Access denied; you need (at least one of) the SUPER privilege(s) for this operation
- Difference between Amazon EC2 and AWS Elastic Beanstalk
- Access denied; you need (at least one of) the SUPER privilege(s) for this operation
- Getting Access Denied when calling the PutObject operation with bucket-level permission
- “invalid ELF header” when using the nodejs “ref” module on AWS Lambda
- Laravel 5 Class ‘Collective\Html\HtmlServiceProvider’ not found on AWS
- Google app engine or amazon web services
- “There was a problem with the requested skill’s response” on Alexa Simulator
- Difference between AWS DynamoDB vs. AWS DocumentDB(Newly launched service)? [closed]
- Nginx error: client intended to send too large body
- Is there an Amazon.com API to retrieve product reviews?
- SQS vs RabbitMQ
- Your WSGIPath refers to a file that does not exist
- Amazon Workspaces VM prevented from logging in to WordPress on DreamHost
- df in linux not showing correct free space after file removal
- Disk full, du tells different. How to further investigate?
- How can I upgrade to Java 1.8 on an Amazon Linux Server?
- How do you increase a KVM guest’s disk space?
- What Linux distribution is the Amazon Linux AMI based on?
- How long before an s3 bucket can be created with same name after deletion?