Example restore object from Glacier doesn't work
See original GitHub issueI was trying to retrieve some elements from glacier, for that I was using the example on the documentation
I tried few configurations but no one of them works so I will keep it as simpler as possible, the code:
import boto3
BUCKET = 'bucket-glacier'
s3 = boto3.resource('s3')
bucket = s3.Bucket(BUCKET)
for obj_sum in bucket.objects.all():
if 'ls' in obj_sum.key:
obj = s3.Object(obj_sum.bucket_name, obj_sum.key)
if obj.storage_class == 'GLACIER':
# Try to restore the object if the storage class is glacier and
# the object does not have a completed or ongoing restoration
# request.
if obj.restore is None:
print('Submitting restoration request: %s' % obj.key)
obj.restore_object()
# Print out objects whose restoration is on-going
elif 'ongoing-request="true"' in obj.restore:
print('Restoration in-progress: %s' % obj.key)
# Print out objects whose restoration is complete
elif 'ongoing-request="false"' in obj.restore:
print('Restoration complete: %s' % obj.key)
I’m having problems in the obj.restore_object()
(which is the most important part)
is showing to me the next error:
*** botocore.exceptions.ClientError: An error occurred (MissingRequestBodyError) when calling the RestoreObject operation: Request Body is empty
I tried also to configure the RestoreRequest
like in the doc of the method but it also didn’t work
*** botocore.exceptions.ClientError: An error occurred (MalformedXML) when calling the RestoreObject operation: The XML you provided was not well-formed or did not validate against our published schema
Versions: Python: 3.5 Boto 3: 1.5.18 botocore: 1.8.32
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
The
RestoreLocation
is used to store the output of your S3 select query.From the API Docs:
OutputLocation
: Describes the location that receives the results of the select restore request.If you need more help with the usage of a service I would suggest reaching out on the service forum.
Closing the issue out here as we merged the changes to update the example client code.
Hm it’s strange that the
Days
parameter is necessary whenRestoreLocation
is specified–I thought the latter meant that the files would be restored to a new location on S3 and would not expire.