Amazon S3
1/13/2025
Amazon S3
Amazon Simple Storage Service (S3) is an object storage service offering scalability, data availability, and security.
Key Concepts
- Bucket: Container for objects
- Object: Files stored in buckets
- Key: Unique identifier for an object
Creating a Bucket
bash
# Create bucket
aws s3 mb s3://my-bucket-name
# List buckets
aws s3 lsWorking with Objects
bash
# Upload file
aws s3 cp file.txt s3://my-bucket/
# Download file
aws s3 cp s3://my-bucket/file.txt .
# Sync directory
aws s3 sync ./local-dir s3://my-bucket/prefix/
# List objects
aws s3 ls s3://my-bucket/
# Delete object
aws s3 rm s3://my-bucket/file.txtBucket Policy
json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
Monkey Knows Wiki