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.

RDS generate_presigned_url does not support the DestinationRegion parameter

See original GitHub issue

Copying encrypted RDS snapshots between different regions requires additional parameters in the PreSignedUrl. However, the boto3 implementation of generate_presigned_url for the RDS client does not support all of them, including DestinationRegion.

PreSignedUrl1=destination_client.generate_presigned_url('copy_db_snapshot', Params={'KmsKeyId':'mykeyid','SourceDBSnapshotIdentifier':'arn:aws:rds:us-west-2:<Account>:snapshot:rds:dbname-2017-01-12-11-40','TargetDBSnapshotIdentifier':'my-test','DestinationRegion':'us-east-1'}, ExpiresIn=1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/botocore/signers.py", line 504, in generate_presigned_url
    params, operation_model)
  File "/usr/local/lib/python2.7/dist-packages/botocore/validate.py", line 270, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "DestinationRegion", must be one of: SourceDBSnapshotIdentifier, TargetDBSnapshotIdentifier, KmsKeyId, Tags, CopyTags, PreSignedUrl, SourceRegion

This is the AWS CLI tools copy command:

aws --region us-east-1 rds copy-db-snapshot --source-db-snapshot-identifier 'arn:aws:rds:us-west-2:<Account>:snapshot:rds:dbname-2017-01-12-11-40' --target-db-snapshot-identifier 'my-test' --source-region us-west-2 --kms-key-id 'mykeyid'

Boto3 documentation includes this requirement as shown in [http://boto3.readthedocs.io/en/latest/reference/services/rds.html#RDS.Client.copy_db_snapshot].

Running:

Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2

boto3 (1.4.3) botocore (1.4.93)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kyleknapcommented, Jan 23, 2017

Yeah I think that version of botocore will not have the parameter available. We released that feature about a month ago and that version: 1.4.81 is about two months old. So if you want to get it working in lambda, you will probably have to deploy with your function the latest version of botocore.

0reactions
pkoracacommented, Sep 15, 2017

Hi,

This issue was related to DestinationRegion parameter but @mohankodali and @kmart1234 verified that SourceRegion works. DestinationRegion still does not work with generate_presigned_url method.

botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "DestinationRegion", must be one of: DBInstanceIdentifier, SourceDBInstanceIdentifier, DBInstanceClass, AvailabilityZone, Port, AutoMinorVersionUpgrade, Iops, OptionGroupName, PubliclyAccessible, Tags, DBSubnetGroupName, StorageType, CopyTagsToSnapshot, MonitoringInterval, MonitoringRoleArn, KmsKeyId, PreSignedUrl, EnableIAMDatabaseAuthentication, SourceRegion

boto3 (1.4.7) botocore (1.7.10)

This is needed to set up read replicas in different regions. link

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

RDS generate_presigned_url does not support the ...
It seems that boto3/botocore does not allow DestinationRegion parameter, which is defined as a requirement on AWS API (link) in case we want...
Read more >
Unable to create a PresignedURL for RDS CopyDBSnapshot
However, because the RDS API requires the 'TargetDBSnapshotIdentifier' parameter, and does not allow for the 'DestinationRegion' parameter ...
Read more >
GeneratePresignedUrlRequest (AWS SDK for Java - 1.12.367)
Creates a new request for generating a pre-signed URL that can be used as part of an HTTP GET request to access the...
Read more >
Presigned URLs — Boto3 Docs 1.26.33 documentation - AWS
can be specified, but the AWS SDK for Python will automatically select the appropriate method so this argument is not normally required.
Read more >
Securing AWS S3 uploads using presigned URLs - Medium
How can I allow users to access objects in S3? ... A pre-signed URL uses three parameters to limit the access to the...
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