Additional High-Level S3 Commands

Learn some higher-level S3 CLI commands.

List buckets and objects

To list buckets and objects, we use the ls subcommand.

Syntax:

aws s3 ls <target> [--options]

Example 1:

This example lists all existing S3 buckets with their creation date and timestamp.

aws s3 ls

Example 2:

This example lists all objects and prefixes inside the my-pets bucket.

aws s3 ls s3://my-pets

Example 3:

This example lists all objects present inside the dogs prefix in my-pets bucket.

aws s3 ls s3://my-pets/dogs/

Example 4:

This example lists all objects present inside a bucket and its prefixes.

aws s3 ls s3://my-pets --recursive

Get hands-on with 1200+ tech skills courses.