@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.165Z") @Stability(value=Stable) 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. |
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnEIPAssociation(software.constructs.Construct scope,
String id)
Create a new `AWS::EC2::EIPAssociation`.
|
|
CfnEIPAssociation(software.constructs.Construct scope,
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 |
|---|---|
String |
getAllocationId()
[EC2-VPC] The allocation ID.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getEip()
[EC2-Classic] The Elastic IP address to associate with the instance.
|
String |
getInstanceId()
The ID of the instance.
|
String |
getNetworkInterfaceId()
[EC2-VPC] The ID of the network interface.
|
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 Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setAllocationId(String value)
[EC2-VPC] The allocation ID.
|
void |
setEip(String value)
[EC2-Classic] The Elastic IP address to associate with the instance.
|
void |
setInstanceId(String value)
The ID of the instance.
|
void |
setNetworkInterfaceId(String value)
[EC2-VPC] The ID of the network interface.
|
void |
setPrivateIpAddress(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, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnEIPAssociation(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnEIPAssociation(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnEIPAssociation(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
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.@Stability(value=Stable)
public CfnEIPAssociation(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @Nullable public String getAllocationId()
This is required for EC2-VPC.
@Stability(value=Stable)
public void setAllocationId(@Nullable
String value)
This is required for EC2-VPC.
@Stability(value=Stable) @Nullable public String getEip()
This is required for EC2-Classic.
@Stability(value=Stable)
public void setEip(@Nullable
String value)
This is required for EC2-Classic.
@Stability(value=Stable) @Nullable public 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.
@Stability(value=Stable)
public void setInstanceId(@Nullable
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.
@Stability(value=Stable) @Nullable public 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.
@Stability(value=Stable)
public void setNetworkInterfaceId(@Nullable
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.
@Stability(value=Stable) @Nullable public String getPrivateIpAddress()
If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
@Stability(value=Stable)
public void setPrivateIpAddress(@Nullable
String value)
If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
Copyright © 2022. All rights reserved.