aws-s3-ls
List objects in an Amazon S3 bucket
TLDR
List all buckets
List files and folders in the root of a bucket (s3:// is optional)
List files and folders directly inside a directory
List all files in a bucket
List all files in a path with a given prefix
Display help
SYNOPSIS
aws s3 ls [s3://BUCKET[/PREFIX]] [options]
Examples:
aws s3 ls (Lists all S3 buckets in your account)
aws s3 ls s3://my-example-bucket/ (Lists objects in 'my-example-bucket')
aws s3 ls s3://my-example-bucket/logs/ --recursive (Lists objects recursively in 'my-example-bucket/logs/')
PARAMETERS
s3://BUCKET[/PREFIX]
An optional S3 URI specifying the bucket or prefix (folder) whose contents you want to list. If omitted, the command lists all S3 buckets accessible by your configured AWS credentials.
--recursive
Lists the contents of the specified S3 path (bucket or prefix) recursively, including all objects within sub-folders. This option is crucial for deep directory listings.
--summarize
Displays a summary at the end of the output, which includes the total number of objects and their combined size. This is useful for getting a quick overview of a bucket's or prefix's contents.
--human-readable-sizes
Displays object sizes in human-readable units (e.g., KB, MB, GB) instead of raw bytes, making the output much easier to read and interpret for humans.
--request-payer requester
Specifies that the requester will pay for the request and data transfer costs. This option is necessary when attempting to access buckets that are configured for 'Requester Pays'.
--profile profile-name
Specifies the named profile from your AWS credentials file to use for this command. This is particularly useful for managing multiple AWS accounts or roles from a single AWS CLI installation.
--region region-name
Specifies the AWS region to send the request to. This option overrides any default region configured in your AWS CLI profile or environment variables for this specific command execution.
DESCRIPTION
The aws s3 ls command, typically aliased or wrapped as aws-s3-ls, is a core utility of the AWS Command Line Interface (CLI). It enables users to view and inspect the contents of Amazon S3 storage directly from their terminal.
This command can list all S3 buckets associated with your AWS account or list objects within a specified bucket or prefix (folder). It provides essential details such as the object's size, last modification date, and name.
It is an indispensable tool for managing and navigating S3 resources programmatically or via scripting, offering a quick and efficient way to inspect storage contents without needing the AWS Management Console.
CAVEATS
The command aws-s3-ls is not a standard Linux command distributed with core Linux utilities. It is almost certainly a user-defined shell alias, a shell function, or a custom script that acts as a convenient wrapper for the official aws s3 ls command provided by the AWS Command Line Interface (CLI). Therefore, its exact functionality or available options might vary depending on how it's defined on your specific system.
To use this command, the AWS CLI must be installed and configured with valid AWS credentials that have sufficient permissions (e.g., s3:ListBucket, s3:GetObject) for the target S3 resources you intend to list.
INSTALLATION AND CONFIGURATION
To utilize aws-s3-ls (as a wrapper for aws s3 ls), you must first install the AWS CLI. Official installation instructions are available on the AWS documentation website. After installation, configure your AWS credentials and default region using the aws configure command to enable authentication with your AWS account.
PERMISSIONS REQUIRED
Accessing Amazon S3 resources necessitates appropriate AWS Identity and Access Management (IAM) permissions. For listing operations, your AWS credentials typically require the s3:ListBucket permission for the bucket itself and, if you're listing objects within a bucket, s3:GetObject permissions for the objects.
HISTORY
The AWS Command Line Interface (CLI) was initially released in 2013, offering a unified tool to manage AWS services from the command line. The aws s3 ls command has been a foundational component of the aws s3 family of commands since its early versions, providing direct and scriptable access to Amazon S3's listing capabilities. Its development has continuously incorporated new S3 features and performance enhancements, reflecting the evolution of Amazon S3 as a cloud storage service.