Canonical: https://weaveos.com/reference/amazon-s3/list-objects-by-prefix

1. [Software capabilities](https://weaveos.com/reference)
2. /[Amazon S3](https://weaveos.com/reference/amazon-s3)
3. /List Amazon S3 objects by prefix

Amazon S3 capability

# List Amazon S3 objects by prefix

Use ListObjectsV2 or aws s3api list-objects-v2 to enumerate keys under a prefix in a general purpose S3 bucket. Both methods operate on key prefixes.

Documentation reviewed November 26, 2026

## Ways to do it

API

### GET /?list-type=2

Send a signed request to the bucket endpoint. Use the prefix parameter and continue with the returned NextContinuationToken when the response is truncated.

- Requirements

  The general purpose bucket name and permission for s3:ListBucket.

- Limitations

  One response returns at most 1,000 keys. The response can include fewer matches and a continuation token.

[Read source: Amazon S3 ListObjectsV2 API ↗](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html)

CLI

### aws s3api list-objects-v2

Run the AWS CLI command with the bucket name and desired prefix. The CLI can retrieve multiple result pages.

- Requirements

  An AWS CLI configuration with credentials authorized for s3:ListBucket.

- Limitations

  The CLI paginates by default. Use --max-items to cap output and resume with the CLI’s --starting-token when one is returned.

Example

```
aws s3api list-objects-v2 --bucket "$BUCKET" --prefix 'reports/' --max-items 25
```

[Read source: AWS CLI list-objects-v2 reference ↗](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-objects-v2.html)
