@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:42.395Z") public class CfnEIPAssociation extends CfnResource implements IInspectable
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 .
An Elastic IP address can be used in EC2-Classic and EC2-VPC accounts. There are differences between an Elastic IP address that you use in a VPC and one that you use in EC2-Classic. For more information, see Differences between instances in EC2-Classic and a VPC .
[EC2-VPC] You must specify AllocationId
and either InstanceId
, NetworkInterfaceId
, or PrivateIpAddress
.
[EC2-Classic] You must specify EIP
and InstanceId
.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.ec2.*; CfnEIPAssociation cfnEIPAssociation = CfnEIPAssociation.Builder.create(this, "MyCfnEIPAssociation") .allocationId("allocationId") .eip("eip") .instanceId("instanceId") .networkInterfaceId("networkInterfaceId") .privateIpAddress("privateIpAddress") .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnEIPAssociation.Builder
A fluent builder for
CfnEIPAssociation . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnEIPAssociation(Construct scope,
java.lang.String id)
Create a new `AWS::EC2::EIPAssociation`.
|
|
CfnEIPAssociation(Construct scope,
java.lang.String id,
CfnEIPAssociationProps props)
Create a new `AWS::EC2::EIPAssociation`.
|
protected |
CfnEIPAssociation(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnEIPAssociation(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAllocationId()
[EC2-VPC] The allocation ID.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getEip()
[EC2-Classic] The Elastic IP address to associate with the instance.
|
java.lang.String |
getInstanceId()
The ID of the instance.
|
java.lang.String |
getNetworkInterfaceId()
[EC2-VPC] The ID of the network interface.
|
java.lang.String |
getPrivateIpAddress()
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAllocationId(java.lang.String value)
[EC2-VPC] The allocation ID.
|
void |
setEip(java.lang.String value)
[EC2-Classic] The Elastic IP address to associate with the instance.
|
void |
setInstanceId(java.lang.String value)
The ID of the instance.
|
void |
setNetworkInterfaceId(java.lang.String value)
[EC2-VPC] The ID of the network interface.
|
void |
setPrivateIpAddress(java.lang.String value)
[EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnEIPAssociation(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnEIPAssociation(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnEIPAssociation(Construct scope, java.lang.String id, CfnEIPAssociationProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties.public CfnEIPAssociation(Construct scope, java.lang.String id)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getAllocationId()
This is required for EC2-VPC.
public void setAllocationId(java.lang.String value)
This is required for EC2-VPC.
public java.lang.String getEip()
This is required for EC2-Classic.
public void setEip(java.lang.String value)
This is required for EC2-Classic.
public java.lang.String getInstanceId()
The instance must have exactly one attached network interface. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must specify an instance ID and the instance must be in the running state.
public void setInstanceId(java.lang.String value)
The instance must have exactly one attached network interface. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. For EC2-Classic, you must specify an instance ID and the instance must be in the running state.
public java.lang.String getNetworkInterfaceId()
If the instance has more than one network interface, you must specify a network interface ID.
For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both.
public void setNetworkInterfaceId(java.lang.String value)
If the instance has more than one network interface, you must specify a network interface ID.
For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both.
public java.lang.String getPrivateIpAddress()
If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
public void setPrivateIpAddress(java.lang.String value)
If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.