【发布时间】:2017-04-25 17:28:48
【问题描述】:
我找不到使用 cloudformation 附加和装载卷的方法。
我可以使用 VolumeAttachment 附加卷;但是,当我在我的 EC2 实例处于运行状态后执行 lsblk 时,我看到这个附加的实例正在被卸载。
有没有办法从 Cloudformation 文件挂载这个实例?我可以使用 linux 命令挂载它,但最好处理来自 cloudformation 的所有内容。
这是我到目前为止所做的:
"MyEc2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" }
}
},
"MyVolume" : {
"Type" : "AWS::EC2::Volume",
"Properties" : {
"Size" : "50",
"AvailabilityZone" : "xyz"
}
},
"attachment" : {
"Type" : "AWS::EC2::VolumeAttachment",
"Properties" : {
"InstanceId" : { "Ref" : "MyEc2Instance" },
"VolumeId" : { "Ref" : "MyVolume" },
"Device" : "/dev/sdh"
}
}
当我在实例上执行lsblk 时,我看到的结果是:
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdh 202:112 0 50G 0 disk
请注意,即使我将设备名称指定为“sdh”,它仍显示为“xvdh”。这是为什么?正如你所看到的,这是卸载的。我如何安装它?
【问题讨论】:
标签: amazon-web-services amazon-ec2 amazon-cloudformation