消息“没有IAM权限来处理AWS :: KMS :: Key资源上的标记”使用Cloudformation创建KMS密钥时

时间:2018-02-23 03:58:29

标签: amazon-web-services amazon-cloudformation amazon-iam amazon-kms

使用Cloudformation创建新的KMS密钥时,我在“状态原因”列中看到此消息:

  

没有IAM权限来处理AWS :: KMS :: Key资源上的标记

cloudformation堆栈似乎是正确创建的,但我想知道如何阻止显示此消息?

我正在使用以下Cloudformation模板来创建KMS密钥:

AWSTemplateFormatVersion: "2010-09-09"
Description: "KMS key"
Outputs:
  KeyArn:
    Value: !Sub "${KmsKey.Arn}"
Resources:
  KmsKey:
    Properties:
      Description: "KMS key"
      Enabled: true
      EnableKeyRotation: false
      KeyPolicy:
        Version: "2012-10-17"
        Statement:
          - Sid: "Enable IAM User Permissions"
            Effect: "Allow"
            Principal: 
              AWS: !Sub "arn:aws:iam::${AWS::AccountId}:root"
            Action: "kms:*"
            Resource: "*"          
    Type: "AWS::KMS::Key"
  KmsKeyAlias:    
    Properties:
      AliasName: "alias/KmsKey"
      TargetKeyId: !Ref "KmsKey"
    Type: "AWS::KMS::Alias"

我用来创建资源的角色允许以下操作:

- Action:
    - kms:Create*
    - kms:List*
  Effect: "Allow"
  Resource: "*"
- Action:
    - kms:Describe*
    - kms:Enable*
    - kms:Put*
    - kms:Update*
    - kms:Get*
    - kms:Decrypt
    - kms:Encrypt
  Effect: "Allow"
  Resource:
    - "arn:aws:kms:*:*:key/*"

1 个答案:

答案 0 :(得分:3)

我的角色错过了以下操作:

- kms:TagResource