question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example restore object from Glacier doesn't work

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
joguSDcommented, Feb 6, 2018

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.

1reaction
jamestwebbercommented, Feb 2, 2018

Hm it’s strange that the Days parameter is necessary when RestoreLocation is specified–I thought the latter meant that the files would be restored to a new location on S3 and would not expire.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restoring an archived object - Amazon Simple Storage Service
Amazon S3 objects that are stored in the S3 Glacier Flexible Retrieval or S3 Glacier Deep Archive storage classes are not immediately accessible....
Read more >
Restore from glacier does not seem to work... - AWS re:Post
Hi everyone, So I manually restored a file from the glacier storage. After a while, it says restoration complete, shows me the restoration...
Read more >
Amazon S3 object restore from GLACIER not working with ...
For example, I was able to run this command after restoring glacier_file2.txt aws s3 cp s3://my-source-bucket/glacier_file2.txt ...
Read more >
Restoring 2 million objects from AWS S3 Glacier - Infinity Works
The above AWS CLI command is an example restoration request for a single AWS Glacier stored object. There are two additional parameters ...
Read more >
Restore & Download a Directory from S3 Glacier - Jake Trent
If you want to access this object you've put into GLACIER-level storage, you'll need to restore it. Restoring the object creates a temporary ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found