AWS::EC2::EIP
Specifies an Elastic IP (EIP) address and can, optionally, associate it with an Amazon EC2 instance.
You can allocate an Elastic IP address from an address pool owned by AWS or from an address pool created from a public IPv4 address range that you have brought to AWS for use with your AWS resources using bring your own IP addresses (BYOIP). For more information, see Bring Your Own IP Addresses (BYOIP) in the Amazon EC2 User Guide.
For more information, see Elastic IP Addresses in the Amazon EC2 User Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::EC2::EIP", "Properties" : { "Address" :
String
, "Domain" :String
, "InstanceId" :String
, "IpamPoolId" :String
, "NetworkBorderGroup" :String
, "PublicIpv4Pool" :String
, "Tags" :[ Tag, ... ]
, "TransferAddress" :String
} }
YAML
Type: AWS::EC2::EIP Properties: Address:
String
Domain:String
InstanceId:String
IpamPoolId:String
NetworkBorderGroup:String
PublicIpv4Pool:String
Tags:- Tag
TransferAddress:String
Properties
Address
-
An Elastic IP address or a carrier IP address in a Wavelength Zone.
Required: No
Type: String
Update requires: Replacement
Domain
-
The network (
vpc
).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 DependsOn Attribute on this resource.
Required: No
Type: String
Allowed values:
vpc | standard
Update requires: Replacement
InstanceId
-
The ID of the instance.
Important
Updates to the
InstanceId
property may require some interruptions. Updates on an EIP reassociates the address on its associated resource.Required: No
Type: String
Update requires: No interruption
IpamPoolId
-
The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it. For more information, see Allocate sequential Elastic IP addresses from an IPAM pool in the Amazon VPC IPAM User Guide.
Required: No
Type: String
Update requires: Replacement
NetworkBorderGroup
-
A unique set of Availability Zones, Local Zones, or Wavelength Zones from which AWS advertises IP addresses. Use this parameter to limit the IP address to this location. IP addresses cannot move between network border groups.
Use DescribeAvailabilityZones to view the network border groups.
Required: No
Type: String
Update requires: Replacement
PublicIpv4Pool
-
The ID of an address pool that you own. Use this parameter to let Amazon EC2 select an address from the address pool.
Important
Updates to the
PublicIpv4Pool
property may require some interruptions. Updates on an EIP reassociates the address on its associated resource.Required: No
Type: String
Update requires: No interruption
-
Any tags assigned to the Elastic IP address.
Important
Updates to the
Tags
property may require some interruptions. Updates on an EIP reassociates the address on its associated resource.Required: No
Type: Array of Tag
Update requires: No interruption
TransferAddress
-
The Elastic IP address you are accepting for transfer. You can only accept one transferred address. For more information on Elastic IP address transfers, see Transfer Elastic IP addresses in the Amazon Virtual Private Cloud User Guide.
Required: No
Type: String
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the Elastic IP address.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt
.
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. For example,
eipalloc-5723d13e
. PublicIp
-
The Elastic IP address.
Examples
Allocate an Elastic IP address
This example shows how to allocate an Elastic IP address and assign it
to an Amazon EC2 instance with the logical name myInstance
.
JSON
"Resources": { "myEIP" : { "Type" : "AWS::EC2::EIP", "Properties" : { "InstanceId" : { "Ref" : "myInstance" } } } }
YAML
Resources: myEIP: Type: AWS::EC2::EIP Properties: InstanceId: !Ref myInstance