1) Add a lifecycle rule to the bucket
Select your bucket and go to management.
Click on Create lifecycle rule
2) Give the rule name. You can even apply rules to a particular folder.
Choose a rule scope from any of these options given:
1) Limit the scope of this rule using one or more filters
2) This rule applies to all objects in the bucket
3) Lifecycle rule actions: Choose any or all options
1) Transition current versions of objects between storage classes
2) Transition previous versions of objects between storage classes
3) Expire current versions of objects
4) Permanently delete previous versions of objects
5) Delete expired delete markers or incomplete multipart uploads
6) Specify the version
7) Select the type of storage class you want to move as Glacier
8) Specify the number of days after which you want to move such that it automatically moves to it.
4) Set the expiration of the data: Add transition
Storage class transition Types:
1) Standard-IA 30 minimum days
2) Intelligent-Tiering 30 minimum days from 1)
3) One Zone-IA 30 minimum days from 2)
4) Glacier 30 minimum days from 3)
5) Glacier Deep Archive 90 minimum days from 4)
Now specify after how many days you want to delete the data completely
Save the configuration
5) Retrieve the data
Select the file from glacier to retrieve.
Click on the More option and select initiate store.
6) Now specify the number of days that you want the archived data to be accessible from S3 and the type
of the retrieval option you want
Click on restore, your data will be now accessible through S3