[英]Associate an existing Elastic IP with an Ec2 Instance from inside a CloudFormation script?
I have a CloudFormation stack that is used to create multiple copies of an environment. 我有一个CloudFormation堆栈,用于创建环境的多个副本。 Some but not all of these environments will have elastic IPs associated.
这些环境中的一些(但不是全部)将具有关联的弹性IP。
Right now I: 现在我:
On updates to the instance itself,the association is lost. 在更新实例本身时,关联将丢失。
It kind of makes senses that when the underlying instance name is changed when updates are made from the CF stack itself, which causes the IP to become unassigned. 从某种意义上说,当从CF堆栈本身进行更新时,如果更改了基础实例名称,则会导致IP未分配。 So I would like to pass in the ID of the elastic IP as a parameter to the script and assign it manually.
因此,我想将弹性IP的ID作为参数传递给脚本并手动进行分配。
It seems there are two ways to do this , but I don't understand the difference. 看来有两种方法可以做到这一点 ,但我不明白其中的区别。 What is an allocation Id, and when would you need to use it?
什么是分配ID,您何时需要使用它?
"IPAssoc" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"InstanceId" : { "Ref" : "logical name of an AWS::EC2::Instance resource" },
"EIP" : "existing Elastic IP address"
}
}
vs VS
"VpcIPAssoc" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"InstanceId" : { "Ref" : "logical name of an AWS::EC2::Instance resource" },
"AllocationId" : "existing VPC Elastic IP allocation ID"
}
}
The difference is between VPC usage and EC2 Classic. VPC使用率和EC2 Classic之间的区别。
As per http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html , EIP is for use with EC2 Classic and AllocationId is for VPC's. 根据http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html,EIP适用于EC2 Classic,而AllocationId适用于VPC。
For the difference between VPC and EC2 Classic, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html#differences-ec2-classic-vpc . 有关VPC和EC2 Classic之间的区别,请参阅http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html#differences-ec2-classic-vpc 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.