Move files between amazon S3 to Glacier and vice versa programmatically using API

前端 未结 2 1180
感动是毒
感动是毒 2021-02-05 15:07

I am creating a PHP based web application using Amazon\'s S3 and glacier services.

Now I want to give my site users a feature that they can choose any file and make it a

2条回答
  •  时光说笑
    2021-02-05 15:49

    You can use the API to define lifecycle rules that archive files from Amazon S3 to Amazon Glacier and you can use the API to retrieve a temporary copy of files archived to Glacier. However, you cannot use the API to tell Amazon S3 to move specific files into Glacier.

    There are two ways to use Amazon Glacier:

    1. Directly via the Glacier API, which allows you to upload/download archives to/from Glacier vaults
    2. Via Amazon S3 lifecycle rules, which archive data from Amazon S3 into Amazon Glacier

    Connecting directly via the Glacier API allows you to store archives for long-term storage, often used as a replacement for Tape. Data stored via the Glacier API must also be retrieved via the Glacier API. This is typically done with normal enterprise backup software or even light-weight products such as Cloudberry Backup (Windows) or Arq (Mac).

    Using Amazon S3 lifecycle rules allows you to store data in Amazon S3, then define rules that determine when data should be archived to Glacier for long-term storage. For example, data could be archived 90 days after creation. The data transfer is governed by the lifecycle rules, which operate on a daily batch basis. The rules can be set via the putBucketLifecycle API call (available in the PHP SDK), but this only defines the rules -- it is not possible to make an API call that tells S3 to archive specific files to Glacier.

    Amazon S3 has a RestoreObject API call (available in the PHP SDK) to restore a temporary copy of data archived from Glacier back into S3. Please note that restoring data from Glacier takes 3-5 hours.

提交回复
热议问题