1. open S3 web console
2. Create Bucket
You can use any names for your objects, but bucket names must be unique across all of Amazon S3.
Objects stored in Amazon S3 are addressable using the REST API under the domain
bucketname
.s3.amazonaws.com.
For example, if the object
homepage.html
is stored in the Amazon S3 bucket mybucket
its address would be http://mybucket.s3.amazonaws.com/homepage.html
.
For more information, see Virtual Hosting of Buckets.
Install s3cmd
download s3cmd from http://s3tools.org/s3cmd
install on Ubuntu 12.04
$ sudo python setup.py install
configure s3cmd
$ s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
Access key and Secret key are your identifiers for Amazon S3
Access Key: AWS_ACCESS_KEY
Secret Key: AWS_SECRET_KEY
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: PWD_WHAT_U_WANT
Path to GPG program [/usr/bin/gpg]:
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]: Yes
New settings:
Access Key:AWS_ACCESS_KEY
Secret Key: AWS_SECRET_KEY
Encryption password: PWD_WHAT_U_WANT
Path to GPG program: /usr/bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0
Test access with supplied credentials? [Y/n]
Please wait, attempting to list all buckets...
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
Access key and Secret key are your identifiers for Amazon S3
Access Key: AWS_ACCESS_KEY
Secret Key: AWS_SECRET_KEY
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: PWD_WHAT_U_WANT
Path to GPG program [/usr/bin/gpg]:
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]: Yes
New settings:
Access Key:AWS_ACCESS_KEY
Secret Key: AWS_SECRET_KEY
Encryption password: PWD_WHAT_U_WANT
Path to GPG program: /usr/bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0
Test access with supplied credentials? [Y/n]
Please wait, attempting to list all buckets...
Success. Encryption and decryption worked fine :-)
Save settings? [y/N] y
Configuration saved to '/home/oopsmonk/.s3cfg'
Save settings? [y/N] y
Configuration saved to '/home/oopsmonk/.s3cfg'
$
Change .s3cfg permission.
$ chmod 600 /home/oopsmonk/.s3cfg
$ s3cmd mb s3://test.s3cmd.cli
Bucket 's3://test.s3cmd.cli/' created
Bucket 's3://test.s3cmd.cli/' created
put file
$ s3cmd put ./README s3://test.s3cmd.cli/
WARNING: Module python-magic is not available. Guessing MIME types based on file extensions.
./README -> s3://test.s3cmd.cli/README [1 of 1]
13130 of 13130 100% in 1s 11.64 kB/s done
WARNING: Module python-magic is not available. Guessing MIME types based on file extensions.
./README -> s3://test.s3cmd.cli/README [1 of 1]
13130 of 13130 100% in 1s 11.64 kB/s done
delete file
$ s3cmd del s3://test.s3cmd.cli/README
File s3://test.s3cmd.cli/README deleted
File s3://test.s3cmd.cli/README deleted
delete Bucket
$ s3cmd rb s3://test.s3cmd.cli
Bucket 's3://test.s3cmd.cli/' removed
Bucket 's3://test.s3cmd.cli/' removed
Commands:
Make bucket
s3cmd mb s3://BUCKET
Remove bucket
s3cmd rb s3://BUCKET
List objects or buckets
s3cmd ls [s3://BUCKET[/PREFIX]]
List all object in all buckets
s3cmd la
Put file into bucket
s3cmd put FILE [FILE...] s3://BUCKET[/PREFIX]
Get file from bucket
s3cmd get s3://BUCKET/OBJECT LOCAL_FILE
Delete file from bucket
s3cmd del s3://BUCKET/OBJECT
Synchronize a directory tree to S3
s3cmd sync LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR
Disk usage by buckets
s3cmd du [s3://BUCKET[/PREFIX]]
Get various information about Buckets or Files
s3cmd info s3://BUCKET[/OBJECT]
Copy object
s3cmd cp s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
Move object
s3cmd mv s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
Modify Access control list for Bucket or Files
Make bucket
s3cmd mb s3://BUCKET
Remove bucket
s3cmd rb s3://BUCKET
List objects or buckets
s3cmd ls [s3://BUCKET[/PREFIX]]
List all object in all buckets
s3cmd la
Put file into bucket
s3cmd put FILE [FILE...] s3://BUCKET[/PREFIX]
Get file from bucket
s3cmd get s3://BUCKET/OBJECT LOCAL_FILE
Delete file from bucket
s3cmd del s3://BUCKET/OBJECT
Synchronize a directory tree to S3
s3cmd sync LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR
Disk usage by buckets
s3cmd du [s3://BUCKET[/PREFIX]]
Get various information about Buckets or Files
s3cmd info s3://BUCKET[/OBJECT]
Copy object
s3cmd cp s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
Move object
s3cmd mv s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
Modify Access control list for Bucket or Files
s3cmd setacl s3://BUCKET[/OBJECT]
Enable/disable bucket access logging
s3cmd accesslog s3://BUCKET
Sign arbitrary string using the secret key
s3cmd sign STRING-TO-SIGN
Fix invalid file names in a bucket
s3cmd fixbucket s3://BUCKET[/PREFIX]
Create Website from bucket
s3cmd ws-create s3://BUCKET
Delete Website
s3cmd ws-delete s3://BUCKET
Info about Website
s3cmd ws-info s3://BUCKET
List CloudFront distribution points
s3cmd cflist
Display CloudFront distribution point parameters
s3cmd cfinfo [cf://DIST_ID]
Create CloudFront distribution point
s3cmd cfcreate s3://BUCKET
Delete CloudFront distribution point
s3cmd cfdelete cf://DIST_ID
Change CloudFront distribution point parameters
s3cmd cfmodify cf://DIST_ID
Display CloudFront invalidation request(s) status
s3cmd cfinvalinfo cf://DIST_ID[/INVAL_ID]
Enable/disable bucket access logging
s3cmd accesslog s3://BUCKET
Sign arbitrary string using the secret key
s3cmd sign STRING-TO-SIGN
Fix invalid file names in a bucket
s3cmd fixbucket s3://BUCKET[/PREFIX]
Create Website from bucket
s3cmd ws-create s3://BUCKET
Delete Website
s3cmd ws-delete s3://BUCKET
Info about Website
s3cmd ws-info s3://BUCKET
List CloudFront distribution points
s3cmd cflist
Display CloudFront distribution point parameters
s3cmd cfinfo [cf://DIST_ID]
Create CloudFront distribution point
s3cmd cfcreate s3://BUCKET
Delete CloudFront distribution point
s3cmd cfdelete cf://DIST_ID
Change CloudFront distribution point parameters
s3cmd cfmodify cf://DIST_ID
Display CloudFront invalidation request(s) status
s3cmd cfinvalinfo cf://DIST_ID[/INVAL_ID]
No comments:
Post a Comment