Skip to content

aws s3

  • Copy files to S3

ls

# List buckets
aws s3 ls

# List files in a bucket
aws s3 ls "s3://hvitoi"

# Specify region and profile automatically
aws s3 ls "s3://foo?region=us-east-1&profile=prod"

cp

# Copy file to a bucket
aws s3 cp "/tmp/db.sql" "s3://hvitoi/db.sql"

# Copy all files inside of a path
aws s3 cp 's3://path/to/folder' . --include "*" --recursive

presign

  • Pre-signed URL
# generate pre-signed URL for an object
aws s3 presign "s3://mybucket/myobject.txt"
aws s3 presign "s3://mybucket/myobject.txt" --expires-in "300" # 3600 by default

sync

aws s3 sync "s3://bucket-source" "s3://bucket-target"