使用 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/*"