AWS::EC2::EIP
The AWS::EC2::EIP resource allocates an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.
Topics
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::EC2::EIP", "Properties" : { "Domain" :String, "InstanceId" :String, "PublicIpv4Pool" :String} }
YAML
Type: AWS::EC2::EIP Properties: Domain:StringInstanceId:StringPublicIpv4Pool:String
Properties
Domain-
Set to
vpcto allocate the address to your Virtual Private Cloud (VPC). No other values are supported.Note
If you define an Elastic IP address and associate it with a VPC that is defined in the same template, you must declare a dependency on the VPC-gateway attachment by using the
DependsOnattribute on this resource. For more information, see DependsOn Attribute.For more information, see AllocateAddress in the Amazon EC2 API Reference. For more information about Elastic IP Addresses in VPC, go to IP Addressing in Your VPC in the Amazon VPC User Guide.
Required: Conditional. Required when allocating an address to a VPC
Type: String
Update requires: Replacement
InstanceId-
The Instance ID of the Amazon EC2 instance that you want to associate with this Elastic IP address.
Required: No
Type: String
Update requires: No interruption
PublicIpv4Pool-
Specifies the ID of an address pool that you own to let Amazon EC2 select an address from the address pool.
Required: No
Type: String
Update requires: No interruption
Return Values
Ref
When you specify the logical ID of an AWS::EC2::EIP object as an argument to the Ref
function, AWS CloudFormation returns the value of the instance's PublicIp.
For more information about using the Ref function, see Ref.
Fn::GetAtt
Fn::GetAtt returns a value for a specified attribute of this type.
The following are the available attributes and sample return values.
AllocationId-
The ID that AWS assigns to represent the allocation of the address for use with Amazon VPC. This is returned only for VPC elastic IP addresses. Example return value:
eipalloc-5723d13e
For more information about using Fn::GetAtt, see Fn::GetAtt.
Examples
To view AWS::EC2::EIP snippets, see Assigning an Amazon EC2 Elastic IP Using AWS::EC2::EIP Snippet.
