aws-s3api:tldr:d3358
aws-s3api: List the objects inside of a bucket and only show each object's key and size.
$ aws s3api list-objects --bucket ${bucket_name} --query '${Contents[]-{Key: Key, Size: Size}}'
try on your machine
This command is used to list all objects in an Amazon Simple Storage Service (S3) bucket using the AWS Command Line Interface (CLI).
Here's a breakdown of the command syntax:
aws s3api
: This is the AWS CLI command for interacting with the S3 API.list-objects
: This is the specific API action used to list objects in an S3 bucket.--bucket ${bucket_name}
: This option specifies the name of the S3 bucket you want to list objects from.${bucket_name}
is a placeholder that should be replaced with the actual bucket name.--query
: This option allows you to use JMESPath query expressions to filter the output. JMESPath is a query language for JSON-like structures.'${Contents[]-{Key: Key, Size: Size}}'
: This JMESPath query expression is used to customize the output. It retrieves theKey
andSize
properties of each object in the bucket and returns them as a list of key-value pairs.
So, with this command, you'll retrieve a list of objects from the specified S3 bucket, and the output will only include the Key
(name) and Size
properties for each object.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.