Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3: What are considered PUT/COPY/POST/LIST request?

Kindly confirm if this correct:

  • PUT is probably uploading files to S3?
  • COPY is probably copying files within S3?

How about POST and LIST?

Additional question, is get_bucket_filesize() and get_object_filesize() (from PHP SDK) considered a LIST request?

like image 616
IMB Avatar asked Feb 11 '12 16:02

IMB


People also ask

What is difference between put and post in S3?

POST: Takes in data, applies it to the resource identified by the given URI, here the rules you documented for the resource media type are followed. PUT: It will replace whatever is identified by the given URI with this data, and ignore whatever is in there already, if anything.

What is a put in S3?

The PUT request operation is used to add an object to a bucket. The response indicates that the object has been successfully stored. S3 never stores partial objects: if you receive a successful response, then you can be confident that the entire object was stored.

What is copy request in S3?

You can use the S3 PUT Object - Copy request to create a copy of an object that is already stored in S3. A PUT copy operation is the same as performing a GET and then a PUT.

How many get and put request are freely available in S3?

The AWS Free Tier, offered to new AWS customers, gives you 5 GB of storage in the AWS S3 Standard storage tier. This includes up to 2000 PUT, POST, COPY or LIST requests, 20,000 GET requests and 15 GB of outgoing data transfer per month for a year.


1 Answers

From my experience using S3 (and also from the basics of HTTP protocol and REST), POST is the creation of a new object (in S3, it would be the upload of a new file), and PUT is a creation of a new object or update of an existing object (i.e., creation or update of a file). Additionally, from S3 docs:

POST is an alternate form of PUT that enables browser-based uploads as a way of putting objects in buckets

Every time you, for example, get the contents of a given S3 bucket, you're running into a LIST operation. You have not asked, but a GET is the download of a file from S3 and DELETE would obviously be the deletion of a file. Of course these assumptions depend on which SDK you are using (it seems you're using the PHP one) and its underlying implementation. My argument is that it is possible to implement a download using a GET, an upload using a PUT or a POST, and so forth.

Taking a look into S3 REST API, though, I assume get_bucket_filesize() is implemented as a LIST (a GET operation on a bucket brings, along with some more data, the size of each object in the response) and get_object_filesize() is implemented as a GET (using the HEAD operation on a single file also brings its size included in the metadata).

like image 194
Viccari Avatar answered Sep 20 '22 17:09

Viccari