Boto3: s3 object restore_object is broken

Created on 31 Jan 2018  路  3Comments  路  Source: boto/boto3

Hey,

We are trying to run a batch job to restore some objects from glacier using boto3.

The code is very basic,

s3 = boto3.resource('s3')
bucket = s3.Bucket('bucket_name')
s3obj = bucket.Object('object_key')
s3obj.restore_object(RestoreRequest={
        'Days': 60,
        'Tier': 'Bulk'
})

And we get the below errors

2018-01-31 17:57:32,495 INFO    Calling s3:restore_object with {'RestoreRequest': {'Tier': 'Bulk', 'Days': 60}, u'Bucket': ''bucket_name', u'Key': 'object_key'}
2018-01-31 17:57:32,496 botocore.hooks [DEBUG] Event before-parameter-build.s3.RestoreObject: calling handler <function validate_bucket_name at 0x7f27f05df1b8>
2018-01-31 17:57:32,496 botocore.hooks [DEBUG] Event before-parameter-build.s3.RestoreObject: calling handler <bound method S3RegionRedirector.redirect_from_cache of <botocore.utils.S3RegionRedirector object at 0x7f27f0311610>>
2018-01-31 17:57:32,496 ERROR   Caughet Parameter validation failed:

The only thing it works is there is only 'Days' in the RestoreRequest which is not what we need.

awscli==1.10.47
boto3==1.5.22
botocore==1.8.36

P.S
The above RestoreRequest does not work if specify it in aws s3api restore-object --restore-request command the only why it works is if we call aws s3api restore-object --restore-request Days=90,GlacierJobParameters={Tier=Bulk} (I am trying to avoid using it this way to save time on initialization of the cli for every object)

THX

Most helpful comment

The parameters for this operation are definitely a little confusing.
I think you need to call it like this:

s3obj.restore_object(RestoreRequest={
    'Days': 1,
    'GlacierJobParameters': {
        'Tier': 'Bulk'
    }
})

Hopefully that helps!

All 3 comments

I think this is related to #1422, closing in favor of the preexisting issue.

Yea you are right...
Dont know how I missed it, Ive searched for 'restore_object' and found only one unrelated issue...

Anyway, sorry for the inconvenience.
Thank you for the quick response :)

The parameters for this operation are definitely a little confusing.
I think you need to call it like this:

s3obj.restore_object(RestoreRequest={
    'Days': 1,
    'GlacierJobParameters': {
        'Tier': 'Bulk'
    }
})

Hopefully that helps!

Was this page helpful?
0 / 5 - 0 ratings