Skip to content

S3

Terminal window
aws configure list-profiles
Terminal window
aws s3 ls
Terminal window
aws s3 ls s3://{bucket_name}
Terminal window
aws s3 cp {file_path} s3://{bucket_name}
Terminal window
aws s3 cp s3://{bucket_name}/{file_path} {local_path}
Terminal window
aws s3 rm s3://{bucket_name}/{file_path}
Terminal window
aws s3 rm s3://{bucket_name} --recursive
Terminal window
aws s3 sync {dir_path} s3://{bucket_name}
Terminal window
aws s3 sync s3://{bucket_name} {dir_path}
  1. Create a log bucket
Terminal window
aws s3 mb s3://{log_bucket_name}
  1. Setup bucket ACL
Terminal window
aws s3api put-bucket-acl --bucket {log_bucket_name} --grant-write URI=http://acs.amazonaws.com/groups/s3/LogDelivery --grant-read-acp URI=http://acs.amazonaws.com/groups/s3/LogDelivery
  1. Verify the bucket ACL
Terminal window
aws s3api get-bucket-acl --bucket {log_bucket_name}
  1. Setup logging for the bucket
Terminal window
aws s3api put-bucket-logging --bucket {bucket_name} --bucket-logging-status '{"LoggingEnabled": {"TargetBucket": "{log_bucket_name}", "TargetPrefix": "{log_prefix}/"}}'
  1. Verify the bucket logging
Terminal window
aws s3api get-bucket-logging --bucket {bucket_name}
  1. Visualize the logs
Terminal window
aws s3 ls s3://{log_bucket_name}/{log_prefix}