amazon-web-services - 无法使用 Cloudformation 创建 KMS

标签 amazon-web-services aws-cloudformation amazon-kms

我有下面的代码来通过 CF 创建 KMS,但是我从本节中收到模板错误。这里有什么遗漏的吗?

KmsKey:
    Type: AWS::KMS::Key
    Properties:
      Description: KMS-Key
      KeyPolicy:
        Version: "2012-10-17"
        Id: encryption-key
        EnableKeyRotation: "True"
        PendingWindowInDays: 7
        Statement:
          - Sid: Allow administration of the key
            Effect: Allow
            Resource: "*"
            Principal:
              AWS: arn:aws:iam::#{AWS::AccountId}:root
            Action:
              - kms:Create*
              - kms:Describe*
              - kms:Enable*
              - kms:List*
              - kms:Put*
              - kms:Update*
              - kms:Revoke*
              - kms:Disable*
              - kms:Get*
              - kms:Delete*
              - kms:ScheduleKeyDeletion
              - kms:CancelKeyDeletion

最佳答案

目前唯一明显的是以下内容:

AWS: arn:aws:iam::#{AWS::AccountId}:root

应该是:

AWS: !Sub "arn:aws:iam::${AWS::AccountId}:root"

关于amazon-web-services - 无法使用 Cloudformation 创建 KMS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67415371/

相关文章:

amazon-web-services - 如何在 v3 javascript 中查找 aws-sdk 版本

amazon-web-services - 如何为 AWS ECS 任务定义提供环境变量?

python - 云形成 : Reference and use Parameters in inline python code for custom resource?

aws-cloudformation - AWS云信息模板: how to provide StreamName for Kinesis resource?

amazon-web-services - 如何在AWS中通过Node Js获取Cloudformation Template的值?

amazon-web-services - 如何使用Cloudformation创建KMS非对称签名 key 资源?

amazon-web-services - 如何运行现有的 aws 放大项目

python - 创建 AWS KMS key 时出现 MalformedPolicyDocumentException

amazon-web-services - 使用 AWS CDK 加密卷和自己的 KMS key 失败

amazon-web-services - 如何使用 cloudformation 添加防火墙管理器新的 ATP 规则?