forked from ms4720/s3sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME_s3cmd.txt
172 lines (132 loc) · 5.15 KB
/
README_s3cmd.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
Welcome to s3cmd.rb
-------------------
This is a ruby program that wraps S3 operations into a simple command-line tool.
It is inspired by things like rsh3ll, #sh3ll, etc., but shares no code from
them. It's meant as a companion utility to s3sync.rb but could be used on its
own (provided you have read the other readme file and know how to use s3sync in
theory).
I made this even though lots of other "shell"s exist, because I wanted a
single-operation utility, instead of a shell "environment". This lends itself
more to scripting, etc. Also the delete operation on rsh3ll seems to be borken
at the moment? =(
Users not yet familiar with s3sync should read about that first, since s3cmd and
s3sync share a tremendous amount of conventions and syntax. Particularly you
have to set up environment variables prior to calling s3cmd, and s3cmd also uses
the "bucket:key" syntax popularized by s3sync. Many of the options are the same
too. Really, go read the other readme first if you haven't used s3sync yet.
Otherwise you will become confused. It's OK, I'll wait.
....
In general, s3sync and s3cmd complement each other. s3sync is useful to perform
serious synchronization operations, and s3cmd allows you to do simple things
such as bucket management, listing, transferring single files, and the like.
Here is the usage, with examples to follow.
s3cmd.rb [options] <command> [arg(s)] version 1.0.0
--help -h --verbose -v --dryrun -n
--ssl -s --debug -d
Commands:
s3cmd.rb listbuckets [headers]
s3cmd.rb createbucket|deletebucket <bucket> [headers]
s3cmd.rb list <bucket>[:prefix] [max/page] [delimiter] [headers]
s3cmd.rb delete <bucket>:key [headers]
s3cmd.rb deleteall <bucket>[:prefix] [headers]
s3cmd.rb get|put <bucket>:key <file> [headers]
A note about [headers]
----------------------
For some S3 operations, such as "put", you might want to specify certain headers
to the request such as Cache-Control, Expires, x-amz-acl, etc. Rather than
supporting a load of separate command-line options for these, I just allow
header specification. So to upload a file with public-read access you could
say:
s3cmd.rb put MyBucket:TheFile.txt x-amz-acl:public-read
If you don't need to add any particular headers then you can just ignore this
whole [headers] thing and pretend it's not there. This is somewhat of an
advanced option.
Examples
--------
List all the buckets your account owns:
s3cmd.rb listbuckets
Create a new bucket:
s3cmd.rb createbucket BucketName
Create a new bucket in the EU:
s3cmd.rb createbucket BucketName EU
Find out the location constraint of a bucket:
s3cmd.rb location BucketName
Delete an old bucket you don't want any more:
s3cmd.rb deletebucket BucketName
Find out what's in a bucket, 10 lines at a time:
s3cmd.rb list BucketName 10
Only look in a particular prefix:
s3cmd.rb list BucketName:startsWithThis
Look in the virtual "directory" named foo;
lists sub-"directories" and keys that are at this level.
Note that if you specify a delimiter you must specify a max before it.
(until I make the options parsing smarter)
s3cmd.rb list BucketName:foo/ 10 /
Delete a key:
s3cmd.rb delete BucketName:AKey
Delete all keys that match (like a combo between list and delete):
s3cmd.rb deleteall BucketName:SomePrefix
Only pretend you're going to delete all keys that match, but list them:
s3cmd.rb --dryrun deleteall BucketName:SomePrefix
Delete all keys in a bucket (leaving the bucket):
s3cmd.rb deleteall BucketName
Get a file from S3 and store it to a local file
s3cmd.rb get BucketName:TheFileOnS3.txt ALocalFile.txt
Put a local file up to S3
Note we don't automatically set mime type, etc.
NOTE that the order of the options doesn't change. S3 stays first!
s3cmd.rb put BucketName:TheFileOnS3.txt ALocalFile.txt
Change Log:
-----------
2006-10-14:
Created.
-----------
2006-10-16
Version 1.0.1
Force content length to a string value since some ruby's don't convert it right.
-----------
2006-10-25
UTF-8 fixes.
-----------
2006-11-28
Version 1.0.3
Added a couple more error catches to s3try.
----------
2007-01-25
Version 1.0.4
Peter Fales' marker fix.
Also, markers should be decoded into native charset (because that's what s3
expects to see).
----------
2007-02-19
- Updated s3try and s3_s3sync_mod to allow SSL_CERT_FILE
----------
2007-2-25
Added --progress
----------
2007-07-12
Version 1.0.6
Added Alastair Brunton's yaml config code.
----------
2007-11-17
Version 1.2.1
Compatibility for S3 API revisions.
When retries are exhausted, emit an error.
----------
2007-11-20
Version 1.2.2
Handle EU bucket 307 redirects (in s3try.rb)
----------
2007-11-20
Version 1.2.3
Fix SSL verification settings that broke in new S3 API.
----------
2008-01-06
Version 1.2.4
Run from any dir (search "here" for includes).
Search out s3config.yml in some likely places.
Reset connection (properly) on retry-able non-50x errors.
Fix calling format bug preventing it from working from yml.
Added http proxy support.
----------
FNORD