我尝试在AWS cloudformation中编写hostedlambdarotation属性以每隔X天轮换我的凭证,但是部署失败,指出了以下错误- “转换AWS :: SecretsManager-2020-07-23失败,原因是:PostgreSQLSingleUser不是受支持的旋转引擎类型。”
在文档中它说支持上述旋转类型。 Hostedlambdarotation property
有人遇到过类似的问题吗?我使用的是Postgresql,因此想使用上述轮换政策。
任何帮助将不胜感激!
编辑:示例代码
{
"Transform": "AWS::SecretsManager-2020-07-23",
"Resources": {
"Test": {
"Type": "AWS::SecretsManager::Secret",
"Properties": {
"Name": "Test",
"Description": "Secrets for db connectivity",
"SecretString": "{\"username\":\"test\",\"password\":\"test\",\"engine\":\"postgres\",\"host\":\"test.rds.amazonaws.com\",\"port\":\"5432\",\"dbname\":\"test\"}"
}
},
"TestAttachment": {
"Type": "AWS::SecretsManager::SecretTargetAttachment",
"Properties": {
"SecretId": {
"Ref": "Test"
},
"TargetId": "arn:aws:rds:test",
"TargetType": "AWS::RDS::DBInstance"
}
},
"TestSecretRotationSchedule": {
"Type": "AWS::SecretsManager::RotationSchedule",
"Properties": {
"SecretId": {
"Ref": "Test"
},
"HostedRotationLambda": {
"RotationType": "PostgreSQLSingleUser",
"RotationLambdaName": "SecretsManagerRotation",
"VpcSecurityGroupIds": "sg-testid",
"VpcSubnetIds": {
"Fn::Join": [
",",
[
"subnet-test01",
"subnet-test02"
]
]
}
},
"RotationRules": {
"AutomaticallyAfterDays": 45
}
}
}
}
}
答案 0 :(得分:0)
也许自您上次尝试以来已更新?我只是在yaml中使用了或多或少相同的语法,并且在CFN中成功部署了它。
AuroraSecretRotationSchedule:
Type: AWS::SecretsManager::RotationSchedule
DependsOn:
- SecretAuroraClusterAttachment
- AuroraDBInstance
Properties:
HostedRotationLambda:
RotationType: PostgreSQLSingleUser
RotationLambdaName: "PGMasterSecretRotationLambda"
SecretId: !Ref AuroraMasterSecret
RotationRules:
AutomaticallyAfterDays: 30
有趣的是,如果不是您的问题,我永远也不会得到它-我之前指定了MasterSecretArn参数,这导致了错误。免责声明:我尚未测试过该lambda是否真的有效,只是没有部署错误而已。