AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::EC2::EIPAssociation

CfnEIPAssociation

Associates an Elastic IP address with an instance or a network interface. Before you can use an Elastic IP address, you must allocate it to your account. For more information about working with Elastic IP addresses, see [Elastic IP address concepts and rules](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-eips.html#vpc-eip-overview) . You must specify `AllocationId` and either `InstanceId` , `NetworkInterfaceId` , or `PrivateIpAddress` .

Import

import { CfnEIPAssociation } from 'aws-cdk-lib/aws-ec2';

Or use the module namespace:

import * as ec2 from 'aws-cdk-lib/aws-ec2';
// ec2.CfnEIPAssociation

Properties

Configuration passed to the constructor as CfnEIPAssociationProps.

allocationIdOptional
string

The allocation ID. This is required.

eipOptionalDeprecated
string | IEIPRef

Deprecated: this property has been deprecated

instanceIdOptional
string | IInstanceRef

The ID of the instance. The instance must have exactly one attached network interface. You can specify either the instance ID or the network interface ID, but not both.

networkInterfaceIdOptional
string | INetworkInterfaceRef

The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID. You can specify either the instance ID or the network interface ID, but not both.

privateIpAddressOptional
string

The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Get the Amazon EC2 Cheat Sheet

Everything you need to know about Amazon EC2 on one page. HD quality, print-friendly.

Download Free Infographic