Amazon web services 如何在使用Cloudformation脚本创建ec2时分配特定的专用ip(基于我的CIDR和子网的预定义ip基础)
这是我使用的代码,仍然不起作用。我正在尝试使用CloudFormation模板创建即时消息,并使用特定的私有ip地址启动。请帮我解释一下我遗漏了什么:我需要在CloudFormation模板中指定给即时的私有ip在哪里Amazon web services 如何在使用Cloudformation脚本创建ec2时分配特定的专用ip(基于我的CIDR和子网的预定义ip基础),amazon-web-services,amazon-ec2,automation,amazon-cloudformation,Amazon Web Services,Amazon Ec2,Automation,Amazon Cloudformation,这是我使用的代码,仍然不起作用。我正在尝试使用CloudFormation模板创建即时消息,并使用特定的私有ip地址启动。请帮我解释一下我遗漏了什么:我需要在CloudFormation模板中指定给即时的私有ip在哪里 "Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Reg
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"KeyName" : { "Ref" : "KeyName" },
"NetworkInterfaces": [ {
"DeviceIndex": "0",
"PrivateIpAddress" : String,
} ]
}
}```
PrivateIpAddress是指定专用Ip的位置。最好还指定SubnetId,因为您的IP必须与放置实例的子网的CIDR范围相匹配
例如:
InstanceWithFixedPirivateIp:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-07ebfd5b3428b6f4d
InstanceType: t2.micro
Monitoring: false
NetworkInterfaces:
- DeviceIndex: 0
PrivateIpAddress: 172.31.80.12
SubnetId: subnet-a9e16487 # CIDR 172.31.80.0/20
谢谢,我有一种感觉,我错过了一些容易在这里,再次感谢您的快速反应。