Browse code

Added comprehensive README file

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3py/trunk@57 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2007/01/19 12:38:04
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,232 @@
0
+S3cmd tool for Amazon Simple Storage Service (S3)
1
+=================================================
2
+
3
+Author:
4
+    Michal Ludvig <michal@logix.cz>
5
+
6
+S3tools / S3cmd project homepage:
7
+    http://s3tools.sourceforge.net
8
+
9
+Amazon S3 homepage:
10
+    http://aws.amazon.com/s3
11
+
12
+What is Amazon S3
13
+-----------------
14
+Amazon S3 provides a managed internet-accessible storage 
15
+service where anyone can store any amount of data and 
16
+retrieve it later again. Maximum amount of data in one 
17
+"object" is 5GB, maximum number of objects is not limited.
18
+
19
+S3 is a paid service operated by the well known Amazon.com
20
+internet book shop. Before storing anything into S3 you
21
+must sign up for an "AWS" account (where AWS = Amazon Web 
22
+Services) to obtain a pair of identifiers: Access Key and
23
+Secret Key. You will need to give these keys to S3cmd. 
24
+Think of them as if they were a username and password for
25
+your S3 account.
26
+
27
+Pricing explained
28
+-----------------
29
+At the time of this writing the costs of using S3 are:
30
+1) US$0.15 per GB-Month of storage used.
31
+2) US$0.20 per GB of data transferred.
32
+
33
+If for instance on 1st of January you upload 2GB of 
34
+photos in JPEG from your holiday in New Zealand, at the 
35
+end of January you will be charged $0.30 for using 2GB of
36
+storage space for a month and $0.40 for transferring 2GB
37
+of data. That comes to $0.70 for a complete backup of your 
38
+precious holiday pictures. 
39
+
40
+In February you don't touch it. Your data are still on S3 
41
+servers so you pay $0.30 for those two gigabytes, but not
42
+a single cent will be charged for any transfer. That comes 
43
+to $0.30 as an ongoing cost of your backup. Not too bad.
44
+
45
+In March you allow anonymous read access to some of your
46
+pictures and your friends download, say, 500MB of them. 
47
+As the files are owned by you, you are responsible for the 
48
+costs incurred. That means at the end of March you'll be 
49
+charged $0.30 for storage plus $0.07 for the traffic 
50
+generated by your friends.
51
+
52
+There is no minimum monthly contract or a setup fee. What 
53
+you use is what you pay for. At the beginning my bill used
54
+to be like US$0.03 or even nil.
55
+
56
+That's the pricing model of Amazon S3 in a nutshell. Check
57
+Amazon S3 homepage at http://aws.amazon.com/s3 for more 
58
+details. 
59
+
60
+Needless to say that all these money are charged by Amazon 
61
+itself, there is obviously no payment for using S3cmd :-)
62
+
63
+Amazon S3 basics
64
+----------------
65
+Files stored in S3 are called "objects" and their names are 
66
+officially called "keys". Each object belongs to exactly one
67
+"bucket". Buckets are kind of directories or folders with 
68
+some restrictions: 1) each user can only have 100 buckets at 
69
+the most, 2) bucket names must be unique amongst all users 
70
+of S3, 3) buckets can not be nested into a deeper
71
+hierarchy and 4) a name of a bucket can only consist of basic 
72
+alphanumeric characters plus dot (.) and dash (-). No spaces,
73
+no accented or UTF-8 letters, etc.
74
+
75
+On the other hand there are almost no restrictions on object 
76
+names ("keys"). These can be any UTF-8 strings of up to 1024 
77
+bytes long. Interestingly enough the object name can contain
78
+forward slash character (/) thus a "my/funny/picture.jpg" is
79
+a valid object name. Note that there are not directories nor
80
+buckets called "my" and "funny" - it is really a single object 
81
+name called "my/funny/picture.jpg" and S3 does not care at 
82
+all that it _looks_ like a directory structure.
83
+
84
+To describe objects in S3 storage we invented a URI-like
85
+schema in the following form:
86
+
87
+    s3://BUCKET/OBJECT
88
+
89
+See the HowTo later in this document for example usages of 
90
+this S3-URI schema.
91
+
92
+Simple S3cmd HowTo
93
+------------------
94
+1) Register for Amazon AWS / S3
95
+   Go to http://aws.amazon.com/s3, click the "Sign up
96
+   for web service" button in the right column and work 
97
+   through the registration. You will have to supply 
98
+   your Credit Card details in order to allow Amazon 
99
+   charge you for S3 usage. 
100
+   At the end you should posses your Access and Secret Keys
101
+
102
+2) Run "s3cmd --configure"
103
+   You will be asked for the two keys - copy and paste 
104
+   them from your confirmation email or from your Amazon 
105
+   account page. Be careful when copying them! They are 
106
+   case sensitive and must be entered accurately or you'll 
107
+   keep getting errors about invalid signatures or similar.
108
+
109
+3) Run "s3cmd ls" to list all your buckets.
110
+   As you just started using S3 there are no buckets owned by 
111
+   you as of now. So the output will be empty.
112
+
113
+4) Make a bucket with "s3cmd mb s3://my-new-bucket-name"
114
+   As mentioned above bucket names must be unique amongst 
115
+   _all_ users of S3. That means the simple names like "test" 
116
+   or "asdf" are already taken and you must make up something 
117
+   more original. I sometimes prefix my bucket names with
118
+   my e-mail domain name (logix.cz) leading to a bucket name,
119
+   for instance, 'logix.cz-test':
120
+
121
+   ~$ s3cmd mb s3://logix.cz-test
122
+   Bucket 'logix.cz-test' created
123
+
124
+5) List your buckets again with "s3cmd ls"
125
+   Now you should see your freshly created bucket
126
+
127
+   ~$ s3cmd ls
128
+   2007-01-19 01:41  s3://logix.cz-test
129
+
130
+6) List the contents of the bucket
131
+
132
+   ~$ s3cmd ls s3://logix.cz-test
133
+   Bucket 'logix.cz-test':
134
+   ~$ 
135
+
136
+   It's empty, indeed.
137
+
138
+7) Upload a file into the bucket
139
+
140
+   ~$ s3cmd put addressbook.xml s3://logix.cz-test/addrbook.xml
141
+   File 'addressbook.xml' stored as s3://logix.cz-test/addrbook.xml (123456 bytes)
142
+
143
+8) Now we can list the bucket contents again
144
+
145
+   ~$ s3cmd ls s3://logix.cz-test
146
+   Bucket 'logix.cz-test':
147
+   2007-01-19 01:46       120k  s3://logix.cz-test/addrbook.xml
148
+
149
+9) Retrieve the file back and verify that its hasn't been 
150
+   corrupted
151
+
152
+   ~$ s3cmd get s3://logix.cz-test/addrbook.xml addressbook-2.xml
153
+   Object s3://logix.cz-test/addrbook.xml saved as 'addressbook-2.xml' (123456 bytes)
154
+
155
+   ~$ md5sum addressbook.xml addressbook-2.xml
156
+   39bcb6992e461b269b95b3bda303addf  addressbook.xml
157
+   39bcb6992e461b269b95b3bda303addf  addressbook-2.xml
158
+
159
+   Checksums of the original file matches the one of the 
160
+   retrieved one. Looks like it worked :-)
161
+
162
+10) Clean up: delete the object and remove the bucket
163
+
164
+   ~$ s3cmd rb s3://logix.cz-test
165
+   ERROR: S3 error: 409 (Conflict): BucketNotEmpty
166
+
167
+   Ouch, we can only remove empty buckets!
168
+
169
+   ~$ s3cmd del s3://logix.cz-test/addrbook.xml
170
+   Object s3://logix.cz-test/addrbook.xml deleted
171
+
172
+   ~$ s3cmd rb s3://logix.cz-test
173
+   Bucket 'logix.cz-test' removed
174
+
175
+Hints
176
+-----
177
+The basic usage is as simple as described in the previous 
178
+section.
179
+
180
+You can increase the level of verbosity with -v option and 
181
+if you're really keen to know what the program does under 
182
+its bonet run it with -d to see all 'debugging' output.
183
+
184
+After configuring it with --configure all available options
185
+are spitted into your ~/.s3cfg file. It's a text file ready
186
+to be modified in your favourite text editor. 
187
+
188
+Multiple local files may be specified for "s3cmd put" 
189
+operation. In that case the S3 URI should only include
190
+the bucket name, not the object part:
191
+
192
+~$ s3cmd put file-* s3://logix.cz-test/
193
+File 'file-one.txt' stored as s3://logix.cz-test/file-one.txt (4 bytes)
194
+File 'file-two.txt' stored as s3://logix.cz-test/file-two.txt (4 bytes)
195
+
196
+Alternatively if you specify the object part as well it 
197
+will be treated as a prefix and all filenames given on the
198
+command line will be appended to the prefix making up 
199
+the object name. However --force option is required in this
200
+case:
201
+
202
+~$ s3cmd put --force file-* s3://logix.cz-test/prefixed:
203
+File 'file-one.txt' stored as s3://logix.cz-test/prefixed:file-one.txt (4 bytes)
204
+File 'file-two.txt' stored as s3://logix.cz-test/prefixed:file-two.txt (4 bytes)
205
+
206
+This prefixing mode works with "s3cmd ls" as well:
207
+
208
+~$ s3cmd ls s3://logix.cz-test
209
+Bucket 'logix.cz-test':
210
+2007-01-19 02:12         4   s3://logix.cz-test/file-one.txt
211
+2007-01-19 02:12         4   s3://logix.cz-test/file-two.txt
212
+2007-01-19 02:12         4   s3://logix.cz-test/prefixed:file-one.txt
213
+2007-01-19 02:12         4   s3://logix.cz-test/prefixed:file-two.txt
214
+
215
+Now with a prefix to list only names beginning with "file-":
216
+
217
+~$ s3cmd ls s3://logix.cz-test/file-*
218
+Bucket 'logix.cz-test':
219
+2007-01-19 02:12         4   s3://logix.cz-test/file-one.txt
220
+2007-01-19 02:12         4   s3://logix.cz-test/file-two.txt
221
+
222
+For more information refer to:
223
+* S3cmd / S3tools homepage at http://s3tools.sourceforge.net
224
+* Amazon S3 homepage at http://aws.amazon.com/s3
225
+
226
+Enjoy!
227
+
228
+Michal Ludvig
229
+* michal@logix.cz
230
+* http://www.logix.cz/michal
231
+