Class EipAssociation
Provides an AWS EIP Association as a top level resource, to associate and disassociate Elastic IPs from AWS Instances and Network Interfaces.
NOTE: Do not use this resource to associate an EIP to
aws.lb.LoadBalanceroraws.ec2.NatGatewayresources. Instead use theallocation_idavailable in those resources to allow AWS to manage the association, otherwise you will seeAuthFailureerrors.
NOTE:
aws.ec2.EipAssociationis useful in scenarios where EIPs are either pre-existing or distributed to customers or users and therefore cannot be changed.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var web = new Aws.Ec2.Instance("web", new Aws.Ec2.InstanceArgs
{
Ami = "ami-21f78e11",
AvailabilityZone = "us-west-2a",
InstanceType = "t1.micro",
Tags =
{
{ "Name", "HelloWorld" },
},
});
var example = new Aws.Ec2.Eip("example", new Aws.Ec2.EipArgs
{
Vpc = true,
});
var eipAssoc = new Aws.Ec2.EipAssociation("eipAssoc", new Aws.Ec2.EipAssociationArgs
{
AllocationId = example.Id,
InstanceId = web.Id,
});
}
}
Inherited Members
Namespace: Pulumi.Aws.Ec2
Assembly: Pulumi.Aws.dll
Syntax
public class EipAssociation : CustomResource
Constructors
View SourceEipAssociation(String, EipAssociationArgs, CustomResourceOptions)
Create a EipAssociation resource with the given unique name, arguments, and options.
Declaration
public EipAssociation(string name, EipAssociationArgs args = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| EipAssociationArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAllocationId
The allocation ID. This is required for EC2-VPC.
Declaration
public Output<string> AllocationId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
AllowReassociation
Whether to allow an Elastic IP to
be re-associated. Defaults to true in VPC.
Declaration
public Output<bool?> AllowReassociation { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
InstanceId
The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.
Declaration
public Output<string> InstanceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
NetworkInterfaceId
The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.
Declaration
public Output<string> NetworkInterfaceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PrivateIpAddress
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.
Declaration
public Output<string> PrivateIpAddress { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PublicIp
The Elastic IP address. This is required for EC2-Classic.
Declaration
public Output<string> PublicIp { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, EipAssociationState, CustomResourceOptions)
Get an existing EipAssociation resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static EipAssociation Get(string name, Input<string> id, EipAssociationState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| EipAssociationState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| EipAssociation |