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

后端 未结 3 962
深忆病人
深忆病人 2020-12-28 18:44

Kindly confirm if this correct:

  • PUT is probably uploading files to S3?
  • COPY is probably copying files within S3?
3条回答
  •  醉梦人生
    2020-12-28 19:32

    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).

提交回复
热议问题