- Newest
- Most votes
- Most comments
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:
-
First, you'll need to create a RestoreRequest object for each file you want to restore.
-
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).
-
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();
-
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.
-
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)
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
- 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)
- 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.
Relevant content
- asked 3 months ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 4 months ago
still waiting for answer.