aws.ec2.NatGatewayEipAssociation
Explore with Pulumi AI
Resource for managing an AWS VPC NAT Gateway EIP Association.
!> WARNING: You should not use the aws.ec2.NatGatewayEipAssociation
resource in conjunction with an aws.ec2.NatGateway
resource that has secondary_allocation_ids
configured. Doing so may cause perpetual differences, and result in associations being overwritten.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.NatGatewayEipAssociation("example", {
allocationId: exampleAwsEip.id,
natGatewayId: exampleAwsNatGateway.id,
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.NatGatewayEipAssociation("example",
allocation_id=example_aws_eip["id"],
nat_gateway_id=example_aws_nat_gateway["id"])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewNatGatewayEipAssociation(ctx, "example", &ec2.NatGatewayEipAssociationArgs{
AllocationId: pulumi.Any(exampleAwsEip.Id),
NatGatewayId: pulumi.Any(exampleAwsNatGateway.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.NatGatewayEipAssociation("example", new()
{
AllocationId = exampleAwsEip.Id,
NatGatewayId = exampleAwsNatGateway.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NatGatewayEipAssociation;
import com.pulumi.aws.ec2.NatGatewayEipAssociationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new NatGatewayEipAssociation("example", NatGatewayEipAssociationArgs.builder()
.allocationId(exampleAwsEip.id())
.natGatewayId(exampleAwsNatGateway.id())
.build());
}
}
resources:
example:
type: aws:ec2:NatGatewayEipAssociation
properties:
allocationId: ${exampleAwsEip.id}
natGatewayId: ${exampleAwsNatGateway.id}
Create NatGatewayEipAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NatGatewayEipAssociation(name: string, args: NatGatewayEipAssociationArgs, opts?: CustomResourceOptions);
@overload
def NatGatewayEipAssociation(resource_name: str,
args: NatGatewayEipAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NatGatewayEipAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
allocation_id: Optional[str] = None,
nat_gateway_id: Optional[str] = None,
region: Optional[str] = None,
timeouts: Optional[NatGatewayEipAssociationTimeoutsArgs] = None)
func NewNatGatewayEipAssociation(ctx *Context, name string, args NatGatewayEipAssociationArgs, opts ...ResourceOption) (*NatGatewayEipAssociation, error)
public NatGatewayEipAssociation(string name, NatGatewayEipAssociationArgs args, CustomResourceOptions? opts = null)
public NatGatewayEipAssociation(String name, NatGatewayEipAssociationArgs args)
public NatGatewayEipAssociation(String name, NatGatewayEipAssociationArgs args, CustomResourceOptions options)
type: aws:ec2:NatGatewayEipAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NatGatewayEipAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NatGatewayEipAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NatGatewayEipAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NatGatewayEipAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NatGatewayEipAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var natGatewayEipAssociationResource = new Aws.Ec2.NatGatewayEipAssociation("natGatewayEipAssociationResource", new()
{
AllocationId = "string",
NatGatewayId = "string",
Region = "string",
Timeouts = new Aws.Ec2.Inputs.NatGatewayEipAssociationTimeoutsArgs
{
Create = "string",
Delete = "string",
},
});
example, err := ec2.NewNatGatewayEipAssociation(ctx, "natGatewayEipAssociationResource", &ec2.NatGatewayEipAssociationArgs{
AllocationId: pulumi.String("string"),
NatGatewayId: pulumi.String("string"),
Region: pulumi.String("string"),
Timeouts: &ec2.NatGatewayEipAssociationTimeoutsArgs{
Create: pulumi.String("string"),
Delete: pulumi.String("string"),
},
})
var natGatewayEipAssociationResource = new NatGatewayEipAssociation("natGatewayEipAssociationResource", NatGatewayEipAssociationArgs.builder()
.allocationId("string")
.natGatewayId("string")
.region("string")
.timeouts(NatGatewayEipAssociationTimeoutsArgs.builder()
.create("string")
.delete("string")
.build())
.build());
nat_gateway_eip_association_resource = aws.ec2.NatGatewayEipAssociation("natGatewayEipAssociationResource",
allocation_id="string",
nat_gateway_id="string",
region="string",
timeouts={
"create": "string",
"delete": "string",
})
const natGatewayEipAssociationResource = new aws.ec2.NatGatewayEipAssociation("natGatewayEipAssociationResource", {
allocationId: "string",
natGatewayId: "string",
region: "string",
timeouts: {
create: "string",
"delete": "string",
},
});
type: aws:ec2:NatGatewayEipAssociation
properties:
allocationId: string
natGatewayId: string
region: string
timeouts:
create: string
delete: string
NatGatewayEipAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NatGatewayEipAssociation resource accepts the following input properties:
- Allocation
Id string - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- Nat
Gateway stringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Timeouts
Nat
Gateway Eip Association Timeouts
- Allocation
Id string - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- Nat
Gateway stringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Timeouts
Nat
Gateway Eip Association Timeouts Args
- allocation
Id String - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- nat
Gateway StringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts
Nat
Gateway Eip Association Timeouts
- allocation
Id string - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- nat
Gateway stringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts
Nat
Gateway Eip Association Timeouts
- allocation_
id str - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- nat_
gateway_ strid The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts
Nat
Gateway Eip Association Timeouts Args
- allocation
Id String - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- nat
Gateway StringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts Property Map
Outputs
All input properties are implicitly available as output properties. Additionally, the NatGatewayEipAssociation resource produces the following output properties:
- Association
Id string - Id string
- The provider-assigned unique ID for this managed resource.
- Association
Id string - Id string
- The provider-assigned unique ID for this managed resource.
- association
Id String - id String
- The provider-assigned unique ID for this managed resource.
- association
Id string - id string
- The provider-assigned unique ID for this managed resource.
- association_
id str - id str
- The provider-assigned unique ID for this managed resource.
- association
Id String - id String
- The provider-assigned unique ID for this managed resource.
Look up Existing NatGatewayEipAssociation Resource
Get an existing NatGatewayEipAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NatGatewayEipAssociationState, opts?: CustomResourceOptions): NatGatewayEipAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
allocation_id: Optional[str] = None,
association_id: Optional[str] = None,
nat_gateway_id: Optional[str] = None,
region: Optional[str] = None,
timeouts: Optional[NatGatewayEipAssociationTimeoutsArgs] = None) -> NatGatewayEipAssociation
func GetNatGatewayEipAssociation(ctx *Context, name string, id IDInput, state *NatGatewayEipAssociationState, opts ...ResourceOption) (*NatGatewayEipAssociation, error)
public static NatGatewayEipAssociation Get(string name, Input<string> id, NatGatewayEipAssociationState? state, CustomResourceOptions? opts = null)
public static NatGatewayEipAssociation get(String name, Output<String> id, NatGatewayEipAssociationState state, CustomResourceOptions options)
resources: _: type: aws:ec2:NatGatewayEipAssociation get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Allocation
Id string - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- Association
Id string - Nat
Gateway stringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Timeouts
Nat
Gateway Eip Association Timeouts
- Allocation
Id string - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- Association
Id string - Nat
Gateway stringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Timeouts
Nat
Gateway Eip Association Timeouts Args
- allocation
Id String - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- association
Id String - nat
Gateway StringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts
Nat
Gateway Eip Association Timeouts
- allocation
Id string - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- association
Id string - nat
Gateway stringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts
Nat
Gateway Eip Association Timeouts
- allocation_
id str - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- association_
id str - nat_
gateway_ strid The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts
Nat
Gateway Eip Association Timeouts Args
- allocation
Id String - The ID of the Elastic IP Allocation to associate with the NAT Gateway.
- association
Id String - nat
Gateway StringId The ID of the NAT Gateway to associate the Elastic IP Allocation to.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- timeouts Property Map
Supporting Types
NatGatewayEipAssociationTimeouts, NatGatewayEipAssociationTimeoutsArgs
- Create string
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- Delete string
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- Create string
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- Delete string
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- create String
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- delete String
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- create string
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- delete string
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- create str
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- delete str
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- create String
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- delete String
- A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
Import
Using pulumi import
, import VPC NAT Gateway EIP Association using the nat_gateway_id,allocation_id
. For example:
$ pulumi import aws:ec2/natGatewayEipAssociation:NatGatewayEipAssociation example nat-1234567890abcdef1,eipalloc-1234567890abcdef1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.