GetElasticIp

aws.ec2.Eip provides details about a specific Elastic IP.

Example Usage

Search By Allocation ID (VPC only)

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var byAllocationId = Output.Create(Aws.GetElasticIp.InvokeAsync(new Aws.GetElasticIpArgs
        {
            Id = "eipalloc-12345678",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "eipalloc-12345678"
        _, err := aws.GetElasticIp(ctx, &aws.GetElasticIpArgs{
            Id: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

by_allocation_id = aws.get_elastic_ip(id="eipalloc-12345678")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const byAllocationId = pulumi.output(aws.getElasticIp({
    id: "eipalloc-12345678",
}, { async: true }));

Search By Filters (EC2-Classic or VPC)

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var byFilter = Output.Create(Aws.GetElasticIp.InvokeAsync(new Aws.GetElasticIpArgs
        {
            Filters = 
            {
                new Aws.Inputs.GetElasticIpFilterArgs
                {
                    Name = "tag:Name",
                    Values = 
                    {
                        "exampleNameTagValue",
                    },
                },
            },
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := aws.GetElasticIp(ctx, &aws.GetElasticIpArgs{
            Filters: []aws.GetElasticIpFilter{
                aws.GetElasticIpFilter{
                    Name: "tag:Name",
                    Values: []string{
                        "exampleNameTagValue",
                    },
                },
            },
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

by_filter = aws.get_elastic_ip(filters=[{
    "name": "tag:Name",
    "values": ["exampleNameTagValue"],
}])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const byFilter = pulumi.output(aws.getElasticIp({
    filters: [{
        name: "tag:Name",
        values: ["exampleNameTagValue"],
    }],
}, { async: true }));

Search By Public IP (EC2-Classic or VPC)

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var byPublicIp = Output.Create(Aws.GetElasticIp.InvokeAsync(new Aws.GetElasticIpArgs
        {
            PublicIp = "1.2.3.4",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "1.2.3.4"
        _, err := aws.GetElasticIp(ctx, &aws.GetElasticIpArgs{
            PublicIp: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

by_public_ip = aws.get_elastic_ip(public_ip="1.2.3.4")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const byPublicIp = pulumi.output(aws.getElasticIp({
    publicIp: "1.2.3.4",
}, { async: true }));

Search By Tags (EC2-Classic or VPC)

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var byTags = Output.Create(Aws.GetElasticIp.InvokeAsync(new Aws.GetElasticIpArgs
        {
            Tags = 
            {
                { "Name", "exampleNameTagValue" },
            },
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := aws.GetElasticIp(ctx, &aws.GetElasticIpArgs{
            Tags: map[string]interface{}{
                "Name": "exampleNameTagValue",
            },
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

by_tags = aws.get_elastic_ip(tags={
    "Name": "exampleNameTagValue",
})
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const byTags = pulumi.output(aws.getElasticIp({
    tags: {
        Name: "exampleNameTagValue",
    },
}, { async: true }));

Using GetElasticIp

function getElasticIp(args: GetElasticIpArgs, opts?: InvokeOptions): Promise<GetElasticIpResult>
function  get_elastic_ip(filters=None, id=None, public_ip=None, tags=None, opts=None)
func GetElasticIp(ctx *Context, args *GetElasticIpArgs, opts ...InvokeOption) (*GetElasticIpResult, error)
public static class GetElasticIp {
    public static Task<GetElasticIpResult> InvokeAsync(GetElasticIpArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Filters List<GetElasticIpFilterArgs>

One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the EC2 API Reference.

Id string

The allocation id of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only set public_ip

PublicIp string

The public IP of the specific EIP to retrieve.

Tags Dictionary<string, string>

A map of tags, each pair of which must exactly match a pair on the desired Elastic IP

Filters []GetElasticIpFilter

One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the EC2 API Reference.

Id string

The allocation id of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only set public_ip

PublicIp string

The public IP of the specific EIP to retrieve.

Tags map[string]string

A map of tags, each pair of which must exactly match a pair on the desired Elastic IP

filters GetElasticIpFilter[]

One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the EC2 API Reference.

id string

The allocation id of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only set public_ip

publicIp string

The public IP of the specific EIP to retrieve.

tags {[key: string]: string}

A map of tags, each pair of which must exactly match a pair on the desired Elastic IP

filters List[GetElasticIpFilter]

One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the EC2 API Reference.

id str

The allocation id of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only set public_ip

public_ip str

The public IP of the specific EIP to retrieve.

tags Dict[str, str]

A map of tags, each pair of which must exactly match a pair on the desired Elastic IP

GetElasticIp Result

The following output properties are available:

AssociationId string

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

CustomerOwnedIp string

Customer Owned IP.

CustomerOwnedIpv4Pool string

The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide

Domain string

Indicates whether the address is for use in EC2-Classic (standard) or in a VPC (vpc).

Id string

If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address.

InstanceId string

The ID of the instance that the address is associated with (if any).

NetworkInterfaceId string

The ID of the network interface.

NetworkInterfaceOwnerId string

The ID of the AWS account that owns the network interface.

PrivateDns string

The Private DNS associated with the Elastic IP address.

PrivateIp string

The private IP address associated with the Elastic IP address.

PublicDns string

Public DNS associated with the Elastic IP address.

PublicIp string

Public IP address of Elastic IP.

PublicIpv4Pool string

The ID of an address pool.

Tags Dictionary<string, string>

Key-value map of tags associated with Elastic IP.

Filters List<GetElasticIpFilter>
AssociationId string

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

CustomerOwnedIp string

Customer Owned IP.

CustomerOwnedIpv4Pool string

The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide

Domain string

Indicates whether the address is for use in EC2-Classic (standard) or in a VPC (vpc).

Id string

If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address.

InstanceId string

The ID of the instance that the address is associated with (if any).

NetworkInterfaceId string

The ID of the network interface.

NetworkInterfaceOwnerId string

The ID of the AWS account that owns the network interface.

PrivateDns string

The Private DNS associated with the Elastic IP address.

PrivateIp string

The private IP address associated with the Elastic IP address.

PublicDns string

Public DNS associated with the Elastic IP address.

PublicIp string

Public IP address of Elastic IP.

PublicIpv4Pool string

The ID of an address pool.

Tags map[string]string

Key-value map of tags associated with Elastic IP.

Filters []GetElasticIpFilter
associationId string

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

customerOwnedIp string

Customer Owned IP.

customerOwnedIpv4Pool string

The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide

domain string

Indicates whether the address is for use in EC2-Classic (standard) or in a VPC (vpc).

id string

If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address.

instanceId string

The ID of the instance that the address is associated with (if any).

networkInterfaceId string

The ID of the network interface.

networkInterfaceOwnerId string

The ID of the AWS account that owns the network interface.

privateDns string

The Private DNS associated with the Elastic IP address.

privateIp string

The private IP address associated with the Elastic IP address.

publicDns string

Public DNS associated with the Elastic IP address.

publicIp string

Public IP address of Elastic IP.

publicIpv4Pool string

The ID of an address pool.

tags {[key: string]: string}

Key-value map of tags associated with Elastic IP.

filters GetElasticIpFilter[]
association_id str

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

customer_owned_ip str

Customer Owned IP.

customer_owned_ipv4_pool str

The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide

domain str

Indicates whether the address is for use in EC2-Classic (standard) or in a VPC (vpc).

id str

If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address.

instance_id str

The ID of the instance that the address is associated with (if any).

network_interface_id str

The ID of the network interface.

network_interface_owner_id str

The ID of the AWS account that owns the network interface.

private_dns str

The Private DNS associated with the Elastic IP address.

private_ip str

The private IP address associated with the Elastic IP address.

public_dns str

Public DNS associated with the Elastic IP address.

public_ip str

Public IP address of Elastic IP.

public_ipv4_pool str

The ID of an address pool.

tags Dict[str, str]

Key-value map of tags associated with Elastic IP.

filters List[GetElasticIpFilter]

Supporting Types

GetElasticIpFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string
Values List<string>
Name string
Values []string
name string
values string[]
name str
values List[str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.