1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. Eip

Try AWS Native preview for resources not in the classic version.

AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi

aws.ec2.Eip

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi

    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

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var lb = new Aws.Ec2.Eip("lb", new()
        {
            Instance = aws_instance.Web.Id,
            Vpc = true,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewEip(ctx, "lb", &ec2.EipArgs{
    			Instance: pulumi.Any(aws_instance.Web.Id),
    			Vpc:      pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Eip;
    import com.pulumi.aws.ec2.EipArgs;
    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 lb = new Eip("lb", EipArgs.builder()        
                .instance(aws_instance.web().id())
                .vpc(true)
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    lb = aws.ec2.Eip("lb",
        instance=aws_instance["web"]["id"],
        vpc=True)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const lb = new aws.ec2.Eip("lb", {
        instance: aws_instance.web.id,
        vpc: true,
    });
    
    resources:
      lb:
        type: aws:ec2:Eip
        properties:
          instance: ${aws_instance.web.id}
          vpc: true
    

    Multiple EIPs associated with a single network interface

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var multi_ip = new Aws.Ec2.NetworkInterface("multi-ip", new()
        {
            SubnetId = aws_subnet.Main.Id,
            PrivateIps = new[]
            {
                "10.0.0.10",
                "10.0.0.11",
            },
        });
    
        var one = new Aws.Ec2.Eip("one", new()
        {
            Vpc = true,
            NetworkInterface = multi_ip.Id,
            AssociateWithPrivateIp = "10.0.0.10",
        });
    
        var two = new Aws.Ec2.Eip("two", new()
        {
            Vpc = true,
            NetworkInterface = multi_ip.Id,
            AssociateWithPrivateIp = "10.0.0.11",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewNetworkInterface(ctx, "multi-ip", &ec2.NetworkInterfaceArgs{
    			SubnetId: pulumi.Any(aws_subnet.Main.Id),
    			PrivateIps: pulumi.StringArray{
    				pulumi.String("10.0.0.10"),
    				pulumi.String("10.0.0.11"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewEip(ctx, "one", &ec2.EipArgs{
    			Vpc:                    pulumi.Bool(true),
    			NetworkInterface:       multi_ip.ID(),
    			AssociateWithPrivateIp: pulumi.String("10.0.0.10"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewEip(ctx, "two", &ec2.EipArgs{
    			Vpc:                    pulumi.Bool(true),
    			NetworkInterface:       multi_ip.ID(),
    			AssociateWithPrivateIp: pulumi.String("10.0.0.11"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.NetworkInterface;
    import com.pulumi.aws.ec2.NetworkInterfaceArgs;
    import com.pulumi.aws.ec2.Eip;
    import com.pulumi.aws.ec2.EipArgs;
    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 multi_ip = new NetworkInterface("multi-ip", NetworkInterfaceArgs.builder()        
                .subnetId(aws_subnet.main().id())
                .privateIps(            
                    "10.0.0.10",
                    "10.0.0.11")
                .build());
    
            var one = new Eip("one", EipArgs.builder()        
                .vpc(true)
                .networkInterface(multi_ip.id())
                .associateWithPrivateIp("10.0.0.10")
                .build());
    
            var two = new Eip("two", EipArgs.builder()        
                .vpc(true)
                .networkInterface(multi_ip.id())
                .associateWithPrivateIp("10.0.0.11")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    multi_ip = aws.ec2.NetworkInterface("multi-ip",
        subnet_id=aws_subnet["main"]["id"],
        private_ips=[
            "10.0.0.10",
            "10.0.0.11",
        ])
    one = aws.ec2.Eip("one",
        vpc=True,
        network_interface=multi_ip.id,
        associate_with_private_ip="10.0.0.10")
    two = aws.ec2.Eip("two",
        vpc=True,
        network_interface=multi_ip.id,
        associate_with_private_ip="10.0.0.11")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const multi_ip = new aws.ec2.NetworkInterface("multi-ip", {
        subnetId: aws_subnet.main.id,
        privateIps: [
            "10.0.0.10",
            "10.0.0.11",
        ],
    });
    const one = new aws.ec2.Eip("one", {
        vpc: true,
        networkInterface: multi_ip.id,
        associateWithPrivateIp: "10.0.0.10",
    });
    const two = new aws.ec2.Eip("two", {
        vpc: true,
        networkInterface: multi_ip.id,
        associateWithPrivateIp: "10.0.0.11",
    });
    
    resources:
      multi-ip:
        type: aws:ec2:NetworkInterface
        properties:
          subnetId: ${aws_subnet.main.id}
          privateIps:
            - 10.0.0.10
            - 10.0.0.11
      one:
        type: aws:ec2:Eip
        properties:
          vpc: true
          networkInterface: ${["multi-ip"].id}
          associateWithPrivateIp: 10.0.0.10
      two:
        type: aws:ec2:Eip
        properties:
          vpc: true
          networkInterface: ${["multi-ip"].id}
          associateWithPrivateIp: 10.0.0.11
    

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

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Aws.Ec2.Vpc("default", new()
        {
            CidrBlock = "10.0.0.0/16",
            EnableDnsHostnames = true,
        });
    
        var gw = new Aws.Ec2.InternetGateway("gw", new()
        {
            VpcId = @default.Id,
        });
    
        var myTestSubnet = new Aws.Ec2.Subnet("myTestSubnet", new()
        {
            VpcId = @default.Id,
            CidrBlock = "10.0.0.0/24",
            MapPublicIpOnLaunch = true,
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                gw,
            },
        });
    
        var foo = new Aws.Ec2.Instance("foo", new()
        {
            Ami = "ami-5189a661",
            InstanceType = "t2.micro",
            PrivateIp = "10.0.0.12",
            SubnetId = myTestSubnet.Id,
        });
    
        var bar = new Aws.Ec2.Eip("bar", new()
        {
            Vpc = true,
            Instance = foo.Id,
            AssociateWithPrivateIp = "10.0.0.12",
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                gw,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewVpc(ctx, "default", &ec2.VpcArgs{
    			CidrBlock:          pulumi.String("10.0.0.0/16"),
    			EnableDnsHostnames: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{
    			VpcId: _default.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		myTestSubnet, err := ec2.NewSubnet(ctx, "myTestSubnet", &ec2.SubnetArgs{
    			VpcId:               _default.ID(),
    			CidrBlock:           pulumi.String("10.0.0.0/24"),
    			MapPublicIpOnLaunch: pulumi.Bool(true),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			gw,
    		}))
    		if err != nil {
    			return err
    		}
    		foo, err := ec2.NewInstance(ctx, "foo", &ec2.InstanceArgs{
    			Ami:          pulumi.String("ami-5189a661"),
    			InstanceType: pulumi.String("t2.micro"),
    			PrivateIp:    pulumi.String("10.0.0.12"),
    			SubnetId:     myTestSubnet.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewEip(ctx, "bar", &ec2.EipArgs{
    			Vpc:                    pulumi.Bool(true),
    			Instance:               foo.ID(),
    			AssociateWithPrivateIp: pulumi.String("10.0.0.12"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			gw,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Vpc;
    import com.pulumi.aws.ec2.VpcArgs;
    import com.pulumi.aws.ec2.InternetGateway;
    import com.pulumi.aws.ec2.InternetGatewayArgs;
    import com.pulumi.aws.ec2.Subnet;
    import com.pulumi.aws.ec2.SubnetArgs;
    import com.pulumi.aws.ec2.Instance;
    import com.pulumi.aws.ec2.InstanceArgs;
    import com.pulumi.aws.ec2.Eip;
    import com.pulumi.aws.ec2.EipArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 default_ = new Vpc("default", VpcArgs.builder()        
                .cidrBlock("10.0.0.0/16")
                .enableDnsHostnames(true)
                .build());
    
            var gw = new InternetGateway("gw", InternetGatewayArgs.builder()        
                .vpcId(default_.id())
                .build());
    
            var myTestSubnet = new Subnet("myTestSubnet", SubnetArgs.builder()        
                .vpcId(default_.id())
                .cidrBlock("10.0.0.0/24")
                .mapPublicIpOnLaunch(true)
                .build(), CustomResourceOptions.builder()
                    .dependsOn(gw)
                    .build());
    
            var foo = new Instance("foo", InstanceArgs.builder()        
                .ami("ami-5189a661")
                .instanceType("t2.micro")
                .privateIp("10.0.0.12")
                .subnetId(myTestSubnet.id())
                .build());
    
            var bar = new Eip("bar", EipArgs.builder()        
                .vpc(true)
                .instance(foo.id())
                .associateWithPrivateIp("10.0.0.12")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(gw)
                    .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    default = aws.ec2.Vpc("default",
        cidr_block="10.0.0.0/16",
        enable_dns_hostnames=True)
    gw = aws.ec2.InternetGateway("gw", vpc_id=default.id)
    my_test_subnet = aws.ec2.Subnet("myTestSubnet",
        vpc_id=default.id,
        cidr_block="10.0.0.0/24",
        map_public_ip_on_launch=True,
        opts=pulumi.ResourceOptions(depends_on=[gw]))
    foo = aws.ec2.Instance("foo",
        ami="ami-5189a661",
        instance_type="t2.micro",
        private_ip="10.0.0.12",
        subnet_id=my_test_subnet.id)
    bar = aws.ec2.Eip("bar",
        vpc=True,
        instance=foo.id,
        associate_with_private_ip="10.0.0.12",
        opts=pulumi.ResourceOptions(depends_on=[gw]))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const _default = new aws.ec2.Vpc("default", {
        cidrBlock: "10.0.0.0/16",
        enableDnsHostnames: true,
    });
    const gw = new aws.ec2.InternetGateway("gw", {vpcId: _default.id});
    const myTestSubnet = new aws.ec2.Subnet("myTestSubnet", {
        vpcId: _default.id,
        cidrBlock: "10.0.0.0/24",
        mapPublicIpOnLaunch: true,
    }, {
        dependsOn: [gw],
    });
    const foo = new aws.ec2.Instance("foo", {
        ami: "ami-5189a661",
        instanceType: "t2.micro",
        privateIp: "10.0.0.12",
        subnetId: myTestSubnet.id,
    });
    const bar = new aws.ec2.Eip("bar", {
        vpc: true,
        instance: foo.id,
        associateWithPrivateIp: "10.0.0.12",
    }, {
        dependsOn: [gw],
    });
    
    resources:
      default:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 10.0.0.0/16
          enableDnsHostnames: true
      gw:
        type: aws:ec2:InternetGateway
        properties:
          vpcId: ${default.id}
      myTestSubnet:
        type: aws:ec2:Subnet
        properties:
          vpcId: ${default.id}
          cidrBlock: 10.0.0.0/24
          mapPublicIpOnLaunch: true
        options:
          dependson:
            - ${gw}
      foo:
        type: aws:ec2:Instance
        properties:
          # us-west-2
          ami: ami-5189a661
          instanceType: t2.micro
          privateIp: 10.0.0.12
          subnetId: ${myTestSubnet.id}
      bar:
        type: aws:ec2:Eip
        properties:
          vpc: true
          instance: ${foo.id}
          associateWithPrivateIp: 10.0.0.12
        options:
          dependson:
            - ${gw}
    

    Allocating EIP from the BYOIP pool

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var byoip_ip = new Aws.Ec2.Eip("byoip-ip", new()
        {
            PublicIpv4Pool = "ipv4pool-ec2-012345",
            Vpc = true,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewEip(ctx, "byoip-ip", &ec2.EipArgs{
    			PublicIpv4Pool: pulumi.String("ipv4pool-ec2-012345"),
    			Vpc:            pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Eip;
    import com.pulumi.aws.ec2.EipArgs;
    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 byoip_ip = new Eip("byoip-ip", EipArgs.builder()        
                .publicIpv4Pool("ipv4pool-ec2-012345")
                .vpc(true)
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    byoip_ip = aws.ec2.Eip("byoip-ip",
        public_ipv4_pool="ipv4pool-ec2-012345",
        vpc=True)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const byoip_ip = new aws.ec2.Eip("byoip-ip", {
        publicIpv4Pool: "ipv4pool-ec2-012345",
        vpc: true,
    });
    
    resources:
      byoip-ip:
        type: aws:ec2:Eip
        properties:
          publicIpv4Pool: ipv4pool-ec2-012345
          vpc: true
    

    Create Eip Resource

    new Eip(name: string, args?: EipArgs, opts?: CustomResourceOptions);
    @overload
    def Eip(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            address: Optional[str] = None,
            associate_with_private_ip: Optional[str] = None,
            customer_owned_ipv4_pool: Optional[str] = None,
            instance: Optional[str] = None,
            network_border_group: Optional[str] = None,
            network_interface: Optional[str] = None,
            public_ipv4_pool: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            vpc: Optional[bool] = None)
    @overload
    def Eip(resource_name: str,
            args: Optional[EipArgs] = None,
            opts: Optional[ResourceOptions] = None)
    func NewEip(ctx *Context, name string, args *EipArgs, opts ...ResourceOption) (*Eip, error)
    public Eip(string name, EipArgs? args = null, CustomResourceOptions? opts = null)
    public Eip(String name, EipArgs args)
    public Eip(String name, EipArgs args, CustomResourceOptions options)
    
    type: aws:ec2:Eip
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args EipArgs
    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 EipArgs
    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 EipArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EipArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EipArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Eip Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Eip resource accepts the following input properties:

    Address string

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    AssociateWithPrivateIp string

    User-specified 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.

    CustomerOwnedIpv4Pool string

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    Instance string

    EC2 instance ID.

    NetworkBorderGroup string

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    NetworkInterface string

    Network interface ID to associate with.

    PublicIpv4Pool string

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    Tags Dictionary<string, string>

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Vpc bool

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    Address string

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    AssociateWithPrivateIp string

    User-specified 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.

    CustomerOwnedIpv4Pool string

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    Instance string

    EC2 instance ID.

    NetworkBorderGroup string

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    NetworkInterface string

    Network interface ID to associate with.

    PublicIpv4Pool string

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    Tags map[string]string

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Vpc bool

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address String

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    associateWithPrivateIp String

    User-specified 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.

    customerOwnedIpv4Pool String

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    instance String

    EC2 instance ID.

    networkBorderGroup String

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    networkInterface String

    Network interface ID to associate with.

    publicIpv4Pool String

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags Map<String,String>

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    vpc Boolean

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address string

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    associateWithPrivateIp string

    User-specified 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.

    customerOwnedIpv4Pool string

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    instance string

    EC2 instance ID.

    networkBorderGroup string

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    networkInterface string

    Network interface ID to associate with.

    publicIpv4Pool string

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags {[key: string]: string}

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    vpc boolean

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address str

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    associate_with_private_ip str

    User-specified 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.

    customer_owned_ipv4_pool str

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    instance str

    EC2 instance ID.

    network_border_group str

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    network_interface str

    Network interface ID to associate with.

    public_ipv4_pool str

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags Mapping[str, str]

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    vpc bool

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address String

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    associateWithPrivateIp String

    User-specified 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.

    customerOwnedIpv4Pool String

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    instance String

    EC2 instance ID.

    networkBorderGroup String

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    networkInterface String

    Network interface ID to associate with.

    publicIpv4Pool String

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags Map<String>

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    vpc Boolean

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Eip resource produces the following output properties:

    AllocationId string

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    AssociationId string

    ID representing the association of the address with an instance in a VPC.

    CarrierIp string

    Carrier IP address.

    CustomerOwnedIp string

    Customer owned IP.

    Domain string

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    Id string

    The provider-assigned unique ID for this managed resource.

    PrivateDns string

    The Private DNS associated with the Elastic IP address (if in VPC).

    PrivateIp string

    Contains the private IP address (if in VPC).

    PublicDns string

    Public DNS associated with the Elastic IP address.

    PublicIp string

    Contains the public IP address.

    TagsAll Dictionary<string, string>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    AllocationId string

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    AssociationId string

    ID representing the association of the address with an instance in a VPC.

    CarrierIp string

    Carrier IP address.

    CustomerOwnedIp string

    Customer owned IP.

    Domain string

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    Id string

    The provider-assigned unique ID for this managed resource.

    PrivateDns string

    The Private DNS associated with the Elastic IP address (if in VPC).

    PrivateIp string

    Contains the private IP address (if in VPC).

    PublicDns string

    Public DNS associated with the Elastic IP address.

    PublicIp string

    Contains the public IP address.

    TagsAll map[string]string

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    allocationId String

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associationId String

    ID representing the association of the address with an instance in a VPC.

    carrierIp String

    Carrier IP address.

    customerOwnedIp String

    Customer owned IP.

    domain String

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    id String

    The provider-assigned unique ID for this managed resource.

    privateDns String

    The Private DNS associated with the Elastic IP address (if in VPC).

    privateIp String

    Contains the private IP address (if in VPC).

    publicDns String

    Public DNS associated with the Elastic IP address.

    publicIp String

    Contains the public IP address.

    tagsAll Map<String,String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    allocationId string

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associationId string

    ID representing the association of the address with an instance in a VPC.

    carrierIp string

    Carrier IP address.

    customerOwnedIp string

    Customer owned IP.

    domain string

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    id string

    The provider-assigned unique ID for this managed resource.

    privateDns string

    The Private DNS associated with the Elastic IP address (if in VPC).

    privateIp string

    Contains the private IP address (if in VPC).

    publicDns string

    Public DNS associated with the Elastic IP address.

    publicIp string

    Contains the public IP address.

    tagsAll {[key: string]: string}

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    allocation_id str

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    association_id str

    ID representing the association of the address with an instance in a VPC.

    carrier_ip str

    Carrier IP address.

    customer_owned_ip str

    Customer owned IP.

    domain str

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    id str

    The provider-assigned unique ID for this managed resource.

    private_dns str

    The Private DNS associated with the Elastic IP address (if in VPC).

    private_ip str

    Contains the private IP address (if in VPC).

    public_dns str

    Public DNS associated with the Elastic IP address.

    public_ip str

    Contains the public IP address.

    tags_all Mapping[str, str]

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    allocationId String

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associationId String

    ID representing the association of the address with an instance in a VPC.

    carrierIp String

    Carrier IP address.

    customerOwnedIp String

    Customer owned IP.

    domain String

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    id String

    The provider-assigned unique ID for this managed resource.

    privateDns String

    The Private DNS associated with the Elastic IP address (if in VPC).

    privateIp String

    Contains the private IP address (if in VPC).

    publicDns String

    Public DNS associated with the Elastic IP address.

    publicIp String

    Contains the public IP address.

    tagsAll Map<String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Look up Existing Eip Resource

    Get an existing Eip 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?: EipState, opts?: CustomResourceOptions): Eip
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address: Optional[str] = None,
            allocation_id: Optional[str] = None,
            associate_with_private_ip: Optional[str] = None,
            association_id: Optional[str] = None,
            carrier_ip: Optional[str] = None,
            customer_owned_ip: Optional[str] = None,
            customer_owned_ipv4_pool: Optional[str] = None,
            domain: Optional[str] = None,
            instance: Optional[str] = None,
            network_border_group: Optional[str] = None,
            network_interface: Optional[str] = None,
            private_dns: Optional[str] = None,
            private_ip: Optional[str] = None,
            public_dns: Optional[str] = None,
            public_ip: Optional[str] = None,
            public_ipv4_pool: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None,
            vpc: Optional[bool] = None) -> Eip
    func GetEip(ctx *Context, name string, id IDInput, state *EipState, opts ...ResourceOption) (*Eip, error)
    public static Eip Get(string name, Input<string> id, EipState? state, CustomResourceOptions? opts = null)
    public static Eip get(String name, Output<String> id, EipState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Address string

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    AllocationId string

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    AssociateWithPrivateIp string

    User-specified 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.

    AssociationId string

    ID representing the association of the address with an instance in a VPC.

    CarrierIp string

    Carrier IP address.

    CustomerOwnedIp string

    Customer owned IP.

    CustomerOwnedIpv4Pool string

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    Domain string

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    Instance string

    EC2 instance ID.

    NetworkBorderGroup string

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    NetworkInterface string

    Network interface ID to associate with.

    PrivateDns string

    The Private DNS associated with the Elastic IP address (if in VPC).

    PrivateIp string

    Contains the private IP address (if in VPC).

    PublicDns string

    Public DNS associated with the Elastic IP address.

    PublicIp string

    Contains the public IP address.

    PublicIpv4Pool string

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    Tags Dictionary<string, string>

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    TagsAll Dictionary<string, string>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Vpc bool

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    Address string

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    AllocationId string

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    AssociateWithPrivateIp string

    User-specified 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.

    AssociationId string

    ID representing the association of the address with an instance in a VPC.

    CarrierIp string

    Carrier IP address.

    CustomerOwnedIp string

    Customer owned IP.

    CustomerOwnedIpv4Pool string

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    Domain string

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    Instance string

    EC2 instance ID.

    NetworkBorderGroup string

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    NetworkInterface string

    Network interface ID to associate with.

    PrivateDns string

    The Private DNS associated with the Elastic IP address (if in VPC).

    PrivateIp string

    Contains the private IP address (if in VPC).

    PublicDns string

    Public DNS associated with the Elastic IP address.

    PublicIp string

    Contains the public IP address.

    PublicIpv4Pool string

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    Tags map[string]string

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    TagsAll map[string]string

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Vpc bool

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address String

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    allocationId String

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associateWithPrivateIp String

    User-specified 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.

    associationId String

    ID representing the association of the address with an instance in a VPC.

    carrierIp String

    Carrier IP address.

    customerOwnedIp String

    Customer owned IP.

    customerOwnedIpv4Pool String

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    domain String

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    instance String

    EC2 instance ID.

    networkBorderGroup String

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    networkInterface String

    Network interface ID to associate with.

    privateDns String

    The Private DNS associated with the Elastic IP address (if in VPC).

    privateIp String

    Contains the private IP address (if in VPC).

    publicDns String

    Public DNS associated with the Elastic IP address.

    publicIp String

    Contains the public IP address.

    publicIpv4Pool String

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags Map<String,String>

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tagsAll Map<String,String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    vpc Boolean

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address string

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    allocationId string

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associateWithPrivateIp string

    User-specified 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.

    associationId string

    ID representing the association of the address with an instance in a VPC.

    carrierIp string

    Carrier IP address.

    customerOwnedIp string

    Customer owned IP.

    customerOwnedIpv4Pool string

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    domain string

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    instance string

    EC2 instance ID.

    networkBorderGroup string

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    networkInterface string

    Network interface ID to associate with.

    privateDns string

    The Private DNS associated with the Elastic IP address (if in VPC).

    privateIp string

    Contains the private IP address (if in VPC).

    publicDns string

    Public DNS associated with the Elastic IP address.

    publicIp string

    Contains the public IP address.

    publicIpv4Pool string

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags {[key: string]: string}

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tagsAll {[key: string]: string}

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    vpc boolean

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address str

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    allocation_id str

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associate_with_private_ip str

    User-specified 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.

    association_id str

    ID representing the association of the address with an instance in a VPC.

    carrier_ip str

    Carrier IP address.

    customer_owned_ip str

    Customer owned IP.

    customer_owned_ipv4_pool str

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    domain str

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    instance str

    EC2 instance ID.

    network_border_group str

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    network_interface str

    Network interface ID to associate with.

    private_dns str

    The Private DNS associated with the Elastic IP address (if in VPC).

    private_ip str

    Contains the private IP address (if in VPC).

    public_dns str

    Public DNS associated with the Elastic IP address.

    public_ip str

    Contains the public IP address.

    public_ipv4_pool str

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags Mapping[str, str]

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tags_all Mapping[str, str]

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    vpc bool

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    address String

    IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.

    allocationId String

    ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

    associateWithPrivateIp String

    User-specified 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.

    associationId String

    ID representing the association of the address with an instance in a VPC.

    carrierIp String

    Carrier IP address.

    customerOwnedIp String

    Customer owned IP.

    customerOwnedIpv4Pool String

    ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.

    domain String

    Indicates if this EIP is for use in VPC (vpc) or EC2-Classic (standard).

    instance String

    EC2 instance ID.

    networkBorderGroup String

    Location from which the IP address is advertised. Use this parameter to limit the address to this location.

    networkInterface String

    Network interface ID to associate with.

    privateDns String

    The Private DNS associated with the Elastic IP address (if in VPC).

    privateIp String

    Contains the private IP address (if in VPC).

    publicDns String

    Public DNS associated with the Elastic IP address.

    publicIp String

    Contains the public IP address.

    publicIpv4Pool String

    EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.

    tags Map<String>

    Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tagsAll Map<String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    vpc Boolean

    Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

    Import

    EIPs in a VPC can be imported using their Allocation ID, e.g.,

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

    EIPs in EC2-Classic can be imported using their Public IP, e.g.,

     $ pulumi import aws:ec2/eip:Eip bar 52.0.0.0
    

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the aws Terraform Provider.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi