AWS CloudFormation AWS :: EC2 :: Instance BlockDeviceMappings和卷

编程入门 行业动态 更新时间:2024-10-27 20:34:24
本文介绍了AWS CloudFormation AWS :: EC2 :: Instance BlockDeviceMappings和卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对两个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和卷

本文发布于:2023-11-24 12:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1625157.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:CloudFormation   AWS   BlockDeviceMappings   Instance

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!