0
votes

Trying to restore an s3 object from GLACIER with the code below.

import boto3

s3 = boto3.resource('s3', verify=False)

bucket_name = r"my-source-bucket"
bucket = s3.Bucket(bucket_name)
key ="glacier_file2.txt"

try:
    bucket.meta.client.restore_object(Bucket=bucket_name, Key=key, RestoreRequest={'Days': 1, 'GlacierJobParameters': {'Tier': 'Expedited'}})
except Exception as e:
    print({"Problem Restoring": str(e)})

The code submits successfully, however the object still shows as in GLACIER in the AWS console as well as when I query it with boto3 even days later. If I run the following code I see it still shows GLACIER.

key = s3.Object(bucket_name,key)
print (key.storage_class)
print (key.restore)

>>>>GLACIER
>>>>ongoing-request="false", expiry-date="Sun, 19 Sep 2021 00:00:00 GMT"

When I try to do this same thing in the AWS console, I see that it says it's both in GLACIER AND restore is complete?

enter image description here

Does anyone have any insight? After restoring, I'm actually able to download the file, which tells me it's not actually in GLACIER, despite saying it is in the browser, and also in boto3. Is something wrong with how the storage class is being reported after a restore occurs?

edit I should point out I'm doing an expedited restore, which only takes a few minutes.