I am using AWS S3 for backups. I have it setup right now so that after 30 days objects are moved out to glacier for cold storage. Since these are backups what I would like to do is keep the last 30days of back-ups. Then after 30 days the backups taken on the first of each month. Then the after 1 year the backup taken on the first of the year.
Since A backup is made daily I need a way to tell AWS the following for lifecycle management.
- If backup is more than 30 days old and not taken on the first of the month delete it.
- If backup is more than 1 year old and not taken on the first of the month in the first month of the year delete it.
Right now I have to go in and clean house once a month. The reason I want to do this is that trying to keep every backup from every day get very storage intensive. How would I automate this process?
1 Answers
Answers 1
You are using S3 glacier, you must be aware that The GLACIER storage class is suitable for archiving data where data access is infrequent. Archived objects are not available for real-time access. You must first restore the objects before you can access them.
If your use case wants real-time infrequent access by a user, you should use STANDARD_IA stoarge class instead.
Now, if you want to delete objects after 30 days in your archive, you can follow these steps:
In the Bucket name list, choose the name of the bucket that you want to create a lifecycle policy for.
Choose the Management tab, and then choose Add lifecycle rule.
In the Lifecycle rule dialog box, type a name for your rule to help identify the rule later and to apply this lifecycle rule to all objects in the bucket, choose Next.
Select Current version to define transitions that are applied to the current version of the objects, choose Add transitions and specify Glacier and no. of days after which objects will be transferred to Glacier.
Then click on next and then choose current version and then set expiration period to be 60 days so that objects get automatically deleted after 30 days they have been archived in Glacier .
Review and save your lifecycle policy.
Now if you want to retrieve any archived object from glacier, you can refer to this tutorial AWS Docs, the object by default will be retrieved for a very limited period of time, you can copy that object to make the retrieval permanent and policy will be applicable to that new copy from starting, i.e after 30 days it will be esnt to glacier and then after 30 days it will be deleted.
Also because you want two different lifecycle policies , you can follow this tutorial on multiple lificycle policies. multiple lifecycle policy example
0 comments:
Post a Comment