Professional Documents
Culture Documents
(s3) Commands With The AWS CLI: Create A Bucket
(s3) Commands With The AWS CLI: Create A Bucket
Create a bucket
$ aws s3 mb <target> [--options]
s3 mb examples
The following example creates the s3://bucket-name bucket.
$ aws s3 mb s3://bucket-name
$ aws s3 ls
2018-12-11 17:08:50 my-bucket
2018-12-14 14:55:44 my-bucket2
Delete buckets
Syntax
$ aws s3 rb s3://bucket-name
Delete objects
Syntax
s3 rm examples
Move objects
Use the s3 mv command to move objects from a bucket or a local directory.
Syntax
s3 mv examples
Copy objects
Use the s3 cp command to copy objects from a bucket or a local directory.
Syntax
The following example copies a local file from your current working directory to the Amazon S3
bucket with the s3 cp command.
The following example copies a file from your Amazon S3 bucket to your current working
directory, where ./ specifies your current working directory.
$ aws s3 cp s3://bucket-name/filename.txt ./
The following example uses echo to stream the text "hello world" to the s3://bucket-
name/filename.txt file.
$ aws s3 cp s3://bucket-name/filename.txt -
hello world
Sync objects
Syntax
s3 sync updates any files that have a size or modified time that are different from files with the
same name at the destination. The output displays specific operations performed during the sync.
Notice that the operation recursively synchronizes the subdirectory MySubdirectory and its
contents with s3://my-bucket/path/MySubdirectory.
The following example, which extends the previous one, shows how to use the --
delete option.
C:\Users\Laxminanda>aws configure
C:\Users\Laxminanda>aws s3 mb s3://myclidemobucket
make_bucket: myclidemobucket
********************