我有如下云形成模板。在这里,我想将所有卷 DeleteOnTermination 设为 true。为了实现这一点,我包含了 BlockDeviceMappings 部分,因为它只允许设置 DeleteOnTermination 的值。但我收到错误:unixDevice 的值“/dev/sdf”无效。连接点 /dev/sdf 已在使用中
我究竟做错了什么?我应该从卷部分中删除 /dev/sdf 并将其仅保留在 BlockDeviceMappings 中吗?
"Resources":{
"INSc42a7c2eed094a79acd851bdc9772a13":{
"Type":"AWS::EC2::Instance",
"Properties":{
"InstanceType":"t2.micro",
"BlockDeviceMappings":[
{
"DeviceName":"/dev/sda1",
"Ebs":{
"VolumeSize":"50",
"DeleteOnTermination":"true"
}
},
{
"DeviceName":"/dev/sdf",
"Ebs":{
"VolumeSize":"100",
"DeleteOnTermination":"true"
}
}
],
"ImageId":"ami-6871a115",
"KeyName":"${aws_key_pair.KP6a0efc01a84c4103b648b57b425b0ca2.key_name}",
"NetworkInterfaces":[
{
"AssociatePublicIpAddress":"true",
"DeviceIndex":"0",
"SubnetId":"subnet-07f722e24335cea6f",
"GroupSet":[
"sg-0ed40ed2e6af3db09"
]
}
],
"Volumes":[
{
"Device":"/dev/sdf",
"VolumeId":{
"Ref":"Volume67430dc919ab486a887388695720e574"
}
}
],
"Tags":[
{
"Key":"Name",
"Value":"jagaranteamvoltest"
},
{
"Key":"vid",
"Value":"c42a7c2e-ed09-4a79-acd8-51bdc9772a13"
}
]
}
},
"Alias60d46c3715ee4a72a4d3739b951bd4e0":{
"Type":"AWS::KMS::Alias",
"Properties":{
"AliasName":"alias/KmsKeyVolTest",
"TargetKeyId":{
"Ref":"KmsKey60d46c3715ee4a72a4d3739b951bd4e0"
}
}
},
"KmsKey60d46c3715ee4a72a4d3739b951bd4e0":{
"Type":"AWS::KMS::Key",
"Properties":{
"Description":"key description sample",
"KeyPolicy":{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"Allow access for Key Administrators",
"Effect":"Allow",
"Principal":{
"AWS":[
"${data.aws_caller_identity.current.arn}"
]
},
"Action":[
"kms:Create*",
"kms:Describe*",
"kms:Enable*",
"kms:List*",
"kms:Put*",
"kms:Update*",
"kms:Revoke*",
"kms:Disable*",
"kms:Get*",
"kms:Delete*",
"kms:TagResource",
"kms:UntagResource",
"kms:ScheduleKeyDeletion",
"kms:CancelKeyDeletion",
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:CreateGrant",
"kms:ListGrants",
"kms:DescribeKey",
"ec2:*"
],
"Resource":"*"
}
]
}
}
},
"Volume67430dc919ab486a887388695720e574":{
"Type":"AWS::EC2::Volume",
"DeletionPolicy":"Delete",
"Properties":{
"AutoEnableIO":"false",
"AvailabilityZone":"us-east-1a",
"Encrypted":"true",
"KmsKeyId":{
"Ref":"KmsKey60d46c3715ee4a72a4d3739b951bd4e0"
},
"Size":"15",
"VolumeType":"standard",
"Tags":[
{
"Key":"vid",
"Value":"67430dc9-19ab-486a-8873-88695720e574"
}
]
}
}
},
"Outputs":{
"caceedaacdbdca":{
"Description":"Instance ID",
"Value":{
"Ref":"INSc42a7c2eed094a79acd851bdc9772a13"
}
},
"dceeaadbbde":{
"Description":"KMS Id",
"Value":{
"Ref":"KmsKey60d46c3715ee4a72a4d3739b951bd4e0"
}
}
}
}