【问题标题】:Aws secrets managerAws 机密管理器
【发布时间】:2020-11-25 17:50:03
【问题描述】:

我尝试在 AWS cloudformation 中编写托管 lambdarotation 属性,以在每 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
        }
      }
    }
  }
}

【问题讨论】:

  • 嗨!请您显示模板的相关部分吗?
  • 好的,可以理解。你能分享一些伪代码吗?例如。看起来您正在使用自定义转换,因此最好了解其中的一些细节,以及模板如何挂在一起 - 否则很难知道可能出了什么问题。
  • @PMah 添加了示例代码!
  • 我想如果我是你,我会向 AWS 提出这个问题,如果你有他们的支持包的话。在我看来一切都是正确的......
  • @Shweta 您在哪个地区发布此模板?

标签: amazon-web-services aws-lambda amazon-cloudformation amazon-rds aws-secrets-manager


【解决方案1】:

也许自您上次尝试后它已更新?我只是在 yaml 中使用了或多或少相同的语法,它刚刚在 CFN 中成功部署。

    AuroraSecretRotationSchedule:
      Type: AWS::SecretsManager::RotationSchedule
      DependsOn:
        - SecretAuroraClusterAttachment
        - AuroraDBInstance
      Properties:
        HostedRotationLambda:
          RotationType: PostgreSQLSingleUser
          RotationLambdaName: "PGMasterSecretRotationLambda"
        SecretId: !Ref AuroraMasterSecret
        RotationRules:
          AutomaticallyAfterDays: 30

有趣的是,如果不是因为你的问题,我永远不会得到它——我之前指定了 MasterSecretArn 参数,这导致了错误。免责声明:我没有测试这个 lambda 是否真的有效,只是它部署时没有错误。

【讨论】:

  • 您在哪个区域部署 lambda?
猜你喜欢
  • 2018-11-27
  • 2019-09-13
  • 2021-06-28
  • 2022-01-26
  • 2020-05-22
  • 2022-01-23
  • 1970-01-01
  • 2020-09-01
  • 1970-01-01
相关资源
最近更新 更多