Regarding Restoration expiration time for multiple files.

0

this is scenarios-: suppose I am going to request 20 files for restoration of AWS Glacier all files expiration is 2 days if 10 files are restored after 2 hrs and 10 files are restored after 1 day what will be the restore expiration time of those files supposed requested on 23 Oct 2024 at 14:30

  1. 10 files restored within 2 hours will expire on 25th October 2024 at Midnight.
  2. 10 files restored after 1 day will expire on 26th October 2024 at Midnight.

but I want all 20 files to expire on 26th October 2024 at Midnight, i.e. max of all expiration time. Please share how this can be achieved using AWS SDK Java API.

  • still waiting for answer.

asked 3 months ago59 views
1 Answer
0

To achieve the desired expiration time for all 20 files in your AWS Glacier restoration scenario using the AWS SDK for Java, you can use the RestoreRequest class with specific parameters. Here's how you can approach this:

  1. First, you'll need to create a RestoreRequest object for each file you want to restore.

  2. When building the RestoreRequest, use the days() method to set the lifetime of the active copy. In your case, you want all files to expire on 26th October 2024 at midnight, which is 3 days from the initial request date (23rd October 2024).

  3. You can use the RestoreRequest.Builder to construct your request. Here's an example of how you might set this up:

RestoreRequest restoreRequest = RestoreRequest.builder() .days(3) .glacierJobParameters(GlacierJobParameters.builder() .tier(Tier.STANDARD) .build()) .build();

  1. The days(3) method call sets the expiration time to 3 days from when each individual file is restored, regardless of when the restoration actually completes.

  2. You would then use this RestoreRequest object when initiating the restore for each of your 20 files.

By setting the expiration to 3 days for all files, you ensure that regardless of when each file's restoration completes, they will all expire at the same time - 3 days from the initial request date, which in this case would be 26th October 2024 at midnight.

Remember that the actual implementation might vary depending on how you're initiating the restore requests (e.g., in parallel or sequentially), but the key is to use the same RestoreRequest object with the 3-day expiration for all files.

This approach ensures that all 20 files will have the same expiration time, regardless of when their individual restorations complete, achieving your goal of having all files expire on 26th October 2024 at midnight.
Sources
RestoreRequest.Builder (AWS SDK for Java - 2.21.29)
RestoreRequest (AWS SDK for Java - 2.21.28)

profile picture
answered 3 months ago
  • Thanks for your answer, Unfortunately, it did not work as explained in the answer. let's take an example. I have requested 2 files for restoration

    1. Request on 25 Oct 2024 11:30 AM it is restored within 4-6 hours same day, restoration expiration October 30, 2024, 05:30:00 (UTC+05:30)
    2. Request on 25 Oct 2024 23:45 it is restored within 4-6 hours which is on the next day, restoration expiration October 31, 2024, 05:30:00 (UTC+05:30) according to the answer, both files' restoration should be calculated from the request initiated, not restoration completion.

    Below is a sample code for the RestoreRequest builder. RestoreRequest restoreRequest = RestoreRequest.builder() .days(4) .glacierJobParameters(GlacierJobParameters.builder() .tier(Tier.STANDARD) .build()) .build(); using dependency software.amazon.awssdk s3 2.20.143 version.

    Please let me know if I am missing something. Any help is appreciated. Thank you.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions