Amazon Move files from S3 to Glacier throgh API

1.3k views Asked by At

I am developing an application using Amazon S3 and glacier for file storing. The requirement is that I want to move the files from S3 to glacier and when needed from glacier back to S3. My question is that Is it really possible with their PHP API or not?

1

There are 1 answers

2
John Rotenstein On BEST ANSWER

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.