admin管理员组文章数量:1320610
Trying to deploy Terraform aws_db_instance_automated_backups_replication resource to enable replication of rds backups from 1 region to another. Had this working in AWS commercial, but same deployment in AWS GovCloud fails.
AWS resource definition in TF is:
resource "aws_db_instance_automated_backups_replication" "db_backup_replication" {
provider = aws.recovery_region
source_db_instance_arn = aws_db_instance.db.arn
kms_key_id = data.aws_kms_key.rds_recovery_kms_key.arn
retention_period = local.retention_days
}
...but error in Terraform output is:
│ Error: starting RDS Instance Automated Backups Replication (arn:<partition>:rds:<primary-region>:<aws-accountID>:db:<rds-instance-name>):
operation error RDS: StartDBInstanceAutomatedBackupsReplication,
https response error StatusCode: 400,
RequestID: *******-****-****-****-************,
api error InvalidParameterValue: Encrypted instances require a valid presigned URL.
TF doc lists an optional argument to the resource:
pre_signed_url - (Optional, Forces new resource) A URL that contains a Signature Version 4 signed request for the StartDBInstanceAutomatedBackupsReplication action to be called in the AWS Region of the source DB instance.
...and AWS API doc (.html) has bit more detail:
In an Amazon Web Services GovCloud (US) Region, an URL that contains a Signature Version 4 signed request for the StartDBInstanceAutomatedBackupsReplication operation to call in the Amazon Web Services Region of the source DB instance. The presigned URL must be a valid request for the StartDBInstanceAutomatedBackupsReplication API operation that can run in the Amazon Web Services Region that contains the source DB instance.
This setting applies only to Amazon Web Services GovCloud (US) Regions. It's ignored in other Amazon Web Services Regions.
To learn how to generate a Signature Version 4 signed request, see Authenticating Requests: Using Query Parameters (Amazon Web Services Signature Version 4) and Signature Version 4 Signing Process.
But their linked docs detail generating such preSignedURLs only for s3 URLs. I can't even find that error ("Encrypted instances require a valid presigned URL") in google.
Any ideas?
Trying to deploy Terraform aws_db_instance_automated_backups_replication resource to enable replication of rds backups from 1 region to another. Had this working in AWS commercial, but same deployment in AWS GovCloud fails.
AWS resource definition in TF is:
resource "aws_db_instance_automated_backups_replication" "db_backup_replication" {
provider = aws.recovery_region
source_db_instance_arn = aws_db_instance.db.arn
kms_key_id = data.aws_kms_key.rds_recovery_kms_key.arn
retention_period = local.retention_days
}
...but error in Terraform output is:
│ Error: starting RDS Instance Automated Backups Replication (arn:<partition>:rds:<primary-region>:<aws-accountID>:db:<rds-instance-name>):
operation error RDS: StartDBInstanceAutomatedBackupsReplication,
https response error StatusCode: 400,
RequestID: *******-****-****-****-************,
api error InvalidParameterValue: Encrypted instances require a valid presigned URL.
TF doc lists an optional argument to the resource:
pre_signed_url - (Optional, Forces new resource) A URL that contains a Signature Version 4 signed request for the StartDBInstanceAutomatedBackupsReplication action to be called in the AWS Region of the source DB instance.
...and AWS API doc (https://docs.aws.amazon/cli/latest/reference/rds/start-db-instance-automated-backups-replication.html) has bit more detail:
In an Amazon Web Services GovCloud (US) Region, an URL that contains a Signature Version 4 signed request for the StartDBInstanceAutomatedBackupsReplication operation to call in the Amazon Web Services Region of the source DB instance. The presigned URL must be a valid request for the StartDBInstanceAutomatedBackupsReplication API operation that can run in the Amazon Web Services Region that contains the source DB instance.
This setting applies only to Amazon Web Services GovCloud (US) Regions. It's ignored in other Amazon Web Services Regions.
To learn how to generate a Signature Version 4 signed request, see Authenticating Requests: Using Query Parameters (Amazon Web Services Signature Version 4) and Signature Version 4 Signing Process.
But their linked docs detail generating such preSignedURLs only for s3 URLs. I can't even find that error ("Encrypted instances require a valid presigned URL") in google.
Any ideas?
Share Improve this question asked Jan 18 at 3:46 MikeOMikeO 437 bronze badges2 Answers
Reset to default 0I think boto3 has generate_presigned_url method which can be used to generate pre-signed URL for RDS. Although the documentation only has examples for generating S3 pre-signed URL, it should also work with RDS client provided the ClientMethod
and Params
matches with start_db_instance_automated_backups_replication input requirements
import boto3
session = boto3.Session(profile_name='profile_name')
url = session.client('rds', < source region >).generate_presigned_url(
ClientMethod='start_db_instance_automated_backups_replication',
Params={
'SourceDBInstanceArn': < source db instance arn>,
'BackupRetentionPeriod': < retention period>,
'KmsKeyId': < kms key id >,
'SourceRegion': < source region >
},
ExpiresIn=3600,
HttpMethod=< http method >
)
print(url)
Thanks for the input @vht981230. Seems with AWS CLI call (start-db-instance-automated-backups-replication) has similar inputs but this useful note:
Note: If you are using an Amazon Web Services SDK tool or the CLI, you can specify SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl manually. Specifying SourceRegion autogenerates a presigned URL that is a valid request for the operation that can run in the source Amazon Web Services Region.
https://awscli.amazonaws/v2/documentation/api/latest/reference/rds/start-db-instance-automated-backups-replication.html
I ended up taking that approach in my pipeline with AWSShellScript task after my TF apply. Not ideal taking it out of the TF code...but easier than figuring out the pre-signed-url mechanism.
本文标签:
版权声明:本文标题:amazon web services - RDS StartDBInstanceAutomatedBackupsReplication preSignedURL (GovCloud) from Terraform - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742083351a2419828.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论