Amazon S3 [ Simple Storage Service ]
aws s3 help
aws s3api
一、AWS S3
1、Managing Buckets
High-level aws s3
commands support commonly used bucket operations, such as creating, removing, and listing buckets.
$aws s3 mb s3://bucket_name # create buckets
$aws s3 rb s3://bucket_name # remove buckets [ the bucket must be empty ]
$aws s3 rb s3://bucket_name --force # remove buckets
$aws s3 ls # list buckets
CreationTime Bucket
$aws s3 ls s3://bucket_name
2、Managing Objects
The high-level aws s3
commands make it convenient to manage Amazon S3 objects as well.
The object commands include aws s3 cp
, aws s3 ls
, aws s3 mv
, aws s3 rm
, and sync
. The cp
, ls
, mv
, and rm
commands work similarly to their Unix counterparts and enable you to work seamlessly across your local directories and Amazon S3 buckets.
The sync
command synchronizes the contents of a bucket and a directory, or two buckets.
Note
All high-level commands that involve uploading objects into an Amazon S3 bucket (aws s3 cp
, aws s3 mv
, and aws s3 sync
) automatically perform a multipart upload when the object is large.
Failed uploads cannot be resumed when using these commands. If the multipart upload fails due to a timeout or is manually cancelled by pressing CTRL+C, the AWS CLI cleans up any files created and aborts the upload. This process can take several minutes.
If the process is interrupted by a kill command or system failure, the in-progress multipart upload remains in Amazon S3 and must be cleaned up manually in the AWS Management Console or with the s3api abort-multipart-upload command.
$aws cp / mv / sync + --grants Permission=Grantee_Type=Grantee_ID
Permission : can be set : read , readacl , writeacl or full
Grantee_Type : Specifies how grantee is to be identified ,
can be set : uri , emailaddress , or id
Grantee_ID : Specifies the grantee based on Grantee_Type
uri : The group's URI .
emailaddress : The account's email address
id : The account's canonical ID
$aws s3 cp local_path/file_name s3://bucket_name/ --storage-class REDUCE_REDUNANCY
$aws s3 sync <source> <target> [--options]
When the --recursive
option is used on a directory/folder with cp
, mv
, or rm
, the command walks the directory tree, including all subdirectories. These commands also accept the --exclude
, --include
, and --acl
options as the sync
command does.