我对两个AWS :: EC2 :: Instance属性感到困惑: BlockDeviceMappings 和 Volumes 。
I am sort of confused about two AWS::EC2::Instance properties: BlockDeviceMappings and Volumes.
我读过很多次文档,但仍然不太了解其中的区别。
I have read documentation a number of times but still don't really understand the difference.
这是我的模板:
{ "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "kappoowTest", "Mappings" : { "AmazonLinuxAMI" : { "eu-west-1" : { "AMI" : "ami-d8f9f1ac" }, "us-west-1" : { "AMI" : "ami-b63210f3" } } }, "Resources" : { "SomeInstance" :{ "Type" : "AWS::EC2::Instance", "Properties" : { "AvailabilityZone" : "eu-west-1a", "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "Ebs" : { "VolumeSize" : "50" } }, { "DeviceName" : "/dev/sdd", "Ebs" : { "VolumeSize" : "100" } } ], "DisableApiTermination" : "true", "EbsOptimized" : "true", "ImageId" : { "Fn::FindInMap" : [ "AmazonLinuxAMI", { "Ref" : "AWS::Region" }, "AMI" ]}, "InstanceType" : "m1.large", "KeyName" : "mongo_test", "Monitoring" : "true", "SecurityGroups" : [ "default" ], "Volumes" : [ { "VolumeId" : { "Ref" : "NewVolume" }, "Device" : "/dev/sdk" } ] } }, "NewVolume" : { "Type" : "AWS::EC2::Volume", "Properties" : { "Size" : "100", "AvailabilityZone" : "eu-west-1a" } } }}在这里我创建了3卷。 2 with
Here I have created 3 volumes. 2 with
"BlockDeviceMappings" : [ { "DeviceName" : "/dev/sdc", "Ebs" : { "VolumeSize" : "50" } }, { "DeviceName" : "/dev/sdd", "Ebs" : { "VolumeSize" : "100" } } ]另一个带有:
"Volumes" : [ { "VolumeId" : { "Ref" : "NewVolume" }, "Device" : "/dev/sdk" } ]CloudFormation运行良好,但是我看不到区别。
CloudFormation ran fine, but I fail to see the difference.
有人可以告诉我将EBS卷添加到EC2实例中哪种方法更好,这两种方法有什么区别?
Could someone tell me what which way is better of adding EBS volumes to EC2 instance and what is the difference between these two methods ?
推荐答案借助BlockDeviceMappings,您不仅可以挂载ebs,还可以挂载临时存储。 Volumes仅是ebs卷,并且提供了更好的选项(例如选择AZ或如果要使用PIOP则指定IOP)。 如果您想要的只是简单的ebs卷,则没有区别。
With BlockDeviceMappings you can mount ephemeral storage not only ebs. Volumes is only ebs volumes, and provides better options (like choosing the AZ, or specifying the IOPs if you want to use PIOPs). If all what you want is simple ebs volumes, then there is no difference.
更多推荐
AWS CloudFormation AWS :: EC2 :: Instance BlockDeviceMappings和卷
发布评论