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

编程入门 行业动态 更新时间:2024-10-28 00:22:46
本文介绍了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 与

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,或者如果你想使用 PIOPs 指定 IOPs).如果您想要的只是简单的 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:13:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1625155.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AWS   CloudFormation   aws   BlockDeviceMappings   Instance

发布评论

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

>www.elefans.com

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