-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to restore Glacier to S3 given folder data #380
Comments
Yeah so this is a little tricky. So for the import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('glacier_test')
for obj_sum in bucket.objects.all():
obj = s3.Object(obj_sum.bucket_name, obj_sum.key)
storage_class = obj.storage_class
restore = obj.restore Furthermore, the import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('glacier_test')
for obj_sum in bucket.objects.all():
resp = bucket.meta.client.restore_object(
Bucket=obj_sum.bucket_name,
Key=obj_sum.key,
RestoreRequest={'Days': 1}
) Once you actual send the restore request, you will notice that the import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('glacier_test')
for obj_sum in bucket.objects.all():
obj = s3.Object(obj_sum.bucket_name, obj_sum.key)
storage_class = obj.storage_class
restore = obj.restore
print(obj.key, obj.storage_class, obj.restore)
Output:
test.txt GLACIER ongoing-request="true"
testfile GLACIER ongoing-request="true" To know when the object is ready to download the value will be As a note to myself, based on my walkthrough, it seems that it would be good if we added the following to boto3:
@dduleep Let me know what you think of these suggestions. |
Thanks for your complete description with example. if there is method like s3.object.download.force().
that kind of method hide all low level client call and that will easy to use and understand but i don't have clear idea is possible or not with current boto3 |
Yeah I think that documentation would be good for this. Not sure if |
So I did some researching on the waiter implementation for waiting until a s3 object is restored, and I came to the conclusion that adding a waiter implementation is not the best approach. It would requires pulling of state for roughly 3 to 5 hours to see if a restoration is complete. In addition, for each pull of state a The better implementation would be to expose a SNS notfication event for glacier restorations. There is already a concept in s3 via bucket notifications: http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html. We will talk with S3 to see if they could expose such a feature. Otherwise, I think my PR addresses the other points that I listed. |
Hai kyleknap, I am creating a PHP based web application using Amazon's S3 and glacier services.Now I want to give my site users a feature that they can choose any file and make it archive (means move file from S3 to Glacier) and unarchive (means move file from Glacier to S3). Can you provide an exple demonstrating this actions or any api's for doing this |
I create bucket policy for after 1 day data move s3 to Glacier.
in my bucket has more than 100K objects.
How can i restore Glacier object to S3? and what is most efficient way to download all object in given folder(directly glacier or move glacier data to s3 then download).
In the S3 Restoring Objects document only give Java and .NET example (http://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html). Is there is method in boto3 please explain how to restore S3 object.
This code what i try but there is no such obj.restore
after restore complete how can i get notification like all folder is available for download
The text was updated successfully, but these errors were encountered: