我正在尝试使用 AWS CDK 创建一个 EBS 卷,该卷由我自己在 C# 中的 KMS 密钥加密,使用以下代码段:
var kmsProps = new EncryptionKeyProps
{
Description = "Encryption key for Storage",
EnableKeyRotation = true,
Enabled = true,
Retain = true
};
var kms = new EncryptionKey(stack, "kms-storage", kmsProps);
var kmsAlias = kms.AddAlias("alias/" + stack.StackName + "/storage");
var storageVolume = new CfnVolume(stack, "server-storage-encrypted", new CfnVolumeProps
{
AvailabilityZone = privateSubnet1.AvailabilityZone,
KmsKeyId = kmsAlias.AliasName,
Size = 30,
Encrypted = true,
Tags = new ICfnTag[]
{
new CfnTag {Key = "Name", Value = "Server Storage"}
},
VolumeType = "gp2"
});
但是部署命令失败并出现Volume vol-0e88979f5568c16fa is still creating
错误
知道我在 KMS 政策等方面做错了吗?试图寻找它,我唯一发现的是自动缩放需要访问密钥,与 EBS/EC2 无关