Prerequisites
- AWS CLI v2 installed and configured with appropriate IAM permissions.
- Basic familiarity with your command-line interface (Windows, macOS, or Linux).
If you haven’t installed the AWS CLI, follow the official AWS CLI installation guide.
Quick Reference: Common S3 Commands
1. Listing Buckets and Contents
1.1 List All Buckets
1.2 List Objects in a Bucket
1.3 Recursive Listing
2. Creating a Bucket
Usemb (make bucket) and specify a region if needed:
3. Copying Files with cp
3.1 Local → S3
Upload a single file:3.2 S3 → Local
Download an object to your current directory:3.3 Bucket-to-Bucket Copy
4. Moving Files with mv
The mv command copies then deletes the source.
4.1 Local → S3
4.2 S3 → Local
5. Copying Directories Recursively
To upload an entire folder:6. Deleting Objects
Remove a single file:Deleting objects is irreversible. Double-check the object key before running
aws s3 rm.