pulumi_wasm_providers_aws_mini::ec2

Module eip

source
Expand description

Provides an Elastic IP resource.

Note: EIP may require IGW to exist prior to association. Use depends_on to set an explicit dependency on the IGW.

Note: Do not use network_interface to associate the EIP to aws.lb.LoadBalancer or aws.ec2.NatGateway resources. Instead use the allocation_id available in those resources to allow AWS to manage the association, otherwise you will see AuthFailure errors.

§Example Usage

§Single EIP associated with an instance

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let lb = eip::create(
        "lb",
        EipArgs::builder().domain("vpc").instance("${web.id}").build_struct(),
    );
}

§Multiple EIPs associated with a single network interface

resources:
  multi-ip:
    type: aws:ec2:NetworkInterface
    properties:
      subnetId: ${main.id}
      privateIps:
        - 10.0.0.10
        - 10.0.0.11
  one:
    type: aws:ec2:Eip
    properties:
      domain: vpc
      networkInterface: ${["multi-ip"].id}
      associateWithPrivateIp: 10.0.0.10
  two:
    type: aws:ec2:Eip
    properties:
      domain: vpc
      networkInterface: ${["multi-ip"].id}
      associateWithPrivateIp: 10.0.0.11

§Attaching an EIP to an Instance with a pre-assigned private ip (VPC Only)

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let bar = eip::create(
        "bar",
        EipArgs::builder()
            .associate_with_private_ip("10.0.0.12")
            .domain("vpc")
            .instance("${foo.id}")
            .build_struct(),
    );
    let default = vpc::create(
        "default",
        VpcArgs::builder()
            .cidr_block("10.0.0.0/16")
            .enable_dns_hostnames(true)
            .build_struct(),
    );
    let foo = instance::create(
        "foo",
        InstanceArgs::builder()
            .ami("ami-5189a661")
            .instance_type("t2.micro")
            .private_ip("10.0.0.12")
            .subnet_id("${myTestSubnet.id}")
            .build_struct(),
    );
    let gw = internet_gateway::create(
        "gw",
        InternetGatewayArgs::builder().vpc_id("${default.id}").build_struct(),
    );
    let myTestSubnet = subnet::create(
        "myTestSubnet",
        SubnetArgs::builder()
            .cidr_block("10.0.0.0/24")
            .map_public_ip_on_launch(true)
            .vpc_id("${default.id}")
            .build_struct(),
    );
}

§Allocating EIP from the BYOIP pool

resources:
  byoip-ip:
    type: aws:ec2:Eip
    properties:
      domain: vpc
      publicIpv4Pool: ipv4pool-ec2-012345

§Allocating EIP from the IPAM Pool

resources:
  ipam-ip:
    type: aws:ec2:Eip
    properties:
      domain: vpc
      ipamPoolId: ipam-pool-07ccc86aa41bef7ce

§Import

Using pulumi import, import EIPs in a VPC using their Allocation ID. For example:

$ pulumi import aws:ec2/eip:Eip bar eipalloc-00a10e96

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments