AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.ec2.getElasticIp
Explore with Pulumi AI
aws.ec2.Eip provides details about a specific Elastic IP.
Example Usage
Search By Allocation ID (VPC only)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const byAllocationId = aws.ec2.getElasticIp({
    id: "eipalloc-12345678",
});
import pulumi
import pulumi_aws as aws
by_allocation_id = aws.ec2.get_elastic_ip(id="eipalloc-12345678")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{
			Id: pulumi.StringRef("eipalloc-12345678"),
		}, nil)
		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 byAllocationId = Aws.Ec2.GetElasticIp.Invoke(new()
    {
        Id = "eipalloc-12345678",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetElasticIpArgs;
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) {
        final var byAllocationId = Ec2Functions.getElasticIp(GetElasticIpArgs.builder()
            .id("eipalloc-12345678")
            .build());
    }
}
variables:
  byAllocationId:
    fn::invoke:
      function: aws:ec2:getElasticIp
      arguments:
        id: eipalloc-12345678
Search By Filters (EC2-Classic or VPC)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const byFilter = aws.ec2.getElasticIp({
    filters: [{
        name: "tag:Name",
        values: ["exampleNameTagValue"],
    }],
});
import pulumi
import pulumi_aws as aws
by_filter = aws.ec2.get_elastic_ip(filters=[{
    "name": "tag:Name",
    "values": ["exampleNameTagValue"],
}])
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{
			Filters: []ec2.GetElasticIpFilter{
				{
					Name: "tag:Name",
					Values: []string{
						"exampleNameTagValue",
					},
				},
			},
		}, nil)
		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 byFilter = Aws.Ec2.GetElasticIp.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2.Inputs.GetElasticIpFilterInputArgs
            {
                Name = "tag:Name",
                Values = new[]
                {
                    "exampleNameTagValue",
                },
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetElasticIpArgs;
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) {
        final var byFilter = Ec2Functions.getElasticIp(GetElasticIpArgs.builder()
            .filters(GetElasticIpFilterArgs.builder()
                .name("tag:Name")
                .values("exampleNameTagValue")
                .build())
            .build());
    }
}
variables:
  byFilter:
    fn::invoke:
      function: aws:ec2:getElasticIp
      arguments:
        filters:
          - name: tag:Name
            values:
              - exampleNameTagValue
Search By Public IP (EC2-Classic or VPC)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const byPublicIp = aws.ec2.getElasticIp({
    publicIp: "1.2.3.4",
});
import pulumi
import pulumi_aws as aws
by_public_ip = aws.ec2.get_elastic_ip(public_ip="1.2.3.4")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{
			PublicIp: pulumi.StringRef("1.2.3.4"),
		}, nil)
		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 byPublicIp = Aws.Ec2.GetElasticIp.Invoke(new()
    {
        PublicIp = "1.2.3.4",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetElasticIpArgs;
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) {
        final var byPublicIp = Ec2Functions.getElasticIp(GetElasticIpArgs.builder()
            .publicIp("1.2.3.4")
            .build());
    }
}
variables:
  byPublicIp:
    fn::invoke:
      function: aws:ec2:getElasticIp
      arguments:
        publicIp: 1.2.3.4
Search By Tags (EC2-Classic or VPC)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const byTags = aws.ec2.getElasticIp({
    tags: {
        Name: "exampleNameTagValue",
    },
});
import pulumi
import pulumi_aws as aws
by_tags = aws.ec2.get_elastic_ip(tags={
    "Name": "exampleNameTagValue",
})
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{
			Tags: map[string]interface{}{
				"Name": "exampleNameTagValue",
			},
		}, nil)
		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 byTags = Aws.Ec2.GetElasticIp.Invoke(new()
    {
        Tags = 
        {
            { "Name", "exampleNameTagValue" },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetElasticIpArgs;
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) {
        final var byTags = Ec2Functions.getElasticIp(GetElasticIpArgs.builder()
            .tags(Map.of("Name", "exampleNameTagValue"))
            .build());
    }
}
variables:
  byTags:
    fn::invoke:
      function: aws:ec2:getElasticIp
      arguments:
        tags:
          Name: exampleNameTagValue
Using getElasticIp
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getElasticIp(args: GetElasticIpArgs, opts?: InvokeOptions): Promise<GetElasticIpResult>
function getElasticIpOutput(args: GetElasticIpOutputArgs, opts?: InvokeOptions): Output<GetElasticIpResult>def get_elastic_ip(filters: Optional[Sequence[GetElasticIpFilter]] = None,
                   id: Optional[str] = None,
                   public_ip: Optional[str] = None,
                   tags: Optional[Mapping[str, str]] = None,
                   opts: Optional[InvokeOptions] = None) -> GetElasticIpResult
def get_elastic_ip_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetElasticIpFilterArgs]]]] = None,
                   id: Optional[pulumi.Input[str]] = None,
                   public_ip: Optional[pulumi.Input[str]] = None,
                   tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetElasticIpResult]func GetElasticIp(ctx *Context, args *GetElasticIpArgs, opts ...InvokeOption) (*GetElasticIpResult, error)
func GetElasticIpOutput(ctx *Context, args *GetElasticIpOutputArgs, opts ...InvokeOption) GetElasticIpResultOutput> Note: This function is named GetElasticIp in the Go SDK.
public static class GetElasticIp 
{
    public static Task<GetElasticIpResult> InvokeAsync(GetElasticIpArgs args, InvokeOptions? opts = null)
    public static Output<GetElasticIpResult> Invoke(GetElasticIpInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetElasticIpResult> getElasticIp(GetElasticIpArgs args, InvokeOptions options)
public static Output<GetElasticIpResult> getElasticIp(GetElasticIpArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ec2/getElasticIp:getElasticIp
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetElastic Ip Filter> 
- 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
- Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only setpublic_ip
- PublicIp string
- Public IP of the specific EIP to retrieve.
- Dictionary<string, string>
- Map of tags, each pair of which must exactly match a pair on the desired Elastic IP
- Filters
[]GetElastic Ip Filter 
- 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
- Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only setpublic_ip
- PublicIp string
- Public IP of the specific EIP to retrieve.
- map[string]string
- Map of tags, each pair of which must exactly match a pair on the desired Elastic IP
- filters
List<GetElastic Ip Filter> 
- 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
- Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only setpublic_ip
- publicIp String
- Public IP of the specific EIP to retrieve.
- Map<String,String>
- Map of tags, each pair of which must exactly match a pair on the desired Elastic IP
- filters
GetElastic Ip Filter[] 
- 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
- Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only setpublic_ip
- publicIp string
- Public IP of the specific EIP to retrieve.
- {[key: string]: string}
- Map of tags, each pair of which must exactly match a pair on the desired Elastic IP
- filters
Sequence[GetElastic Ip Filter] 
- 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
- Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only setpublic_ip
- public_ip str
- Public IP of the specific EIP to retrieve.
- Mapping[str, str]
- Map of tags, each pair of which must exactly match a pair on the desired Elastic IP
- filters List<Property Map>
- 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
- Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only setpublic_ip
- publicIp String
- Public IP of the specific EIP to retrieve.
- Map<String>
- 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:
- Arn string
- AssociationId string
- ID representing the association of the address with an instance in a VPC.
- CarrierIp string
- Carrier IP address.
- CustomerOwned stringIp 
- Customer Owned IP.
- CustomerOwned stringIpv4Pool 
- The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
- Domain string
- 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
- ID of the instance that the address is associated with (if any).
- IpamPool stringId 
- The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it.
- NetworkInterface stringId 
- The ID of the network interface.
- NetworkInterface stringOwner Id 
- The ID of the AWS account that owns the network interface.
- PrivateDns string
- Private DNS associated with the Elastic IP address.
- PrivateIp string
- Private IP address associated with the Elastic IP address.
- PtrRecord string
- The DNS pointer (PTR) record for the IP address.
- PublicDns string
- Public DNS associated with the Elastic IP address.
- PublicIp string
- Public IP address of Elastic IP.
- PublicIpv4Pool string
- ID of an address pool.
- Dictionary<string, string>
- Key-value map of tags associated with Elastic IP.
- Filters
List<GetElastic Ip Filter> 
- Arn string
- AssociationId string
- ID representing the association of the address with an instance in a VPC.
- CarrierIp string
- Carrier IP address.
- CustomerOwned stringIp 
- Customer Owned IP.
- CustomerOwned stringIpv4Pool 
- The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
- Domain string
- 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
- ID of the instance that the address is associated with (if any).
- IpamPool stringId 
- The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it.
- NetworkInterface stringId 
- The ID of the network interface.
- NetworkInterface stringOwner Id 
- The ID of the AWS account that owns the network interface.
- PrivateDns string
- Private DNS associated with the Elastic IP address.
- PrivateIp string
- Private IP address associated with the Elastic IP address.
- PtrRecord string
- The DNS pointer (PTR) record for the IP address.
- PublicDns string
- Public DNS associated with the Elastic IP address.
- PublicIp string
- Public IP address of Elastic IP.
- PublicIpv4Pool string
- ID of an address pool.
- map[string]string
- Key-value map of tags associated with Elastic IP.
- Filters
[]GetElastic Ip Filter 
- arn String
- associationId String
- ID representing the association of the address with an instance in a VPC.
- carrierIp String
- Carrier IP address.
- customerOwned StringIp 
- Customer Owned IP.
- customerOwned StringIpv4Pool 
- The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
- domain String
- 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
- ID of the instance that the address is associated with (if any).
- ipamPool StringId 
- The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it.
- networkInterface StringId 
- The ID of the network interface.
- networkInterface StringOwner Id 
- The ID of the AWS account that owns the network interface.
- privateDns String
- Private DNS associated with the Elastic IP address.
- privateIp String
- Private IP address associated with the Elastic IP address.
- ptrRecord String
- The DNS pointer (PTR) record for the IP address.
- publicDns String
- Public DNS associated with the Elastic IP address.
- publicIp String
- Public IP address of Elastic IP.
- publicIpv4Pool String
- ID of an address pool.
- Map<String,String>
- Key-value map of tags associated with Elastic IP.
- filters
List<GetElastic Ip Filter> 
- arn string
- associationId string
- ID representing the association of the address with an instance in a VPC.
- carrierIp string
- Carrier IP address.
- customerOwned stringIp 
- Customer Owned IP.
- customerOwned stringIpv4Pool 
- The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
- domain string
- 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
- ID of the instance that the address is associated with (if any).
- ipamPool stringId 
- The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it.
- networkInterface stringId 
- The ID of the network interface.
- networkInterface stringOwner Id 
- The ID of the AWS account that owns the network interface.
- privateDns string
- Private DNS associated with the Elastic IP address.
- privateIp string
- Private IP address associated with the Elastic IP address.
- ptrRecord string
- The DNS pointer (PTR) record for the IP address.
- publicDns string
- Public DNS associated with the Elastic IP address.
- publicIp string
- Public IP address of Elastic IP.
- publicIpv4Pool string
- ID of an address pool.
- {[key: string]: string}
- Key-value map of tags associated with Elastic IP.
- filters
GetElastic Ip Filter[] 
- arn str
- association_id str
- ID representing the association of the address with an instance in a VPC.
- carrier_ip str
- Carrier IP address.
- customer_owned_ strip 
- Customer Owned IP.
- customer_owned_ stripv4_ pool 
- The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
- domain str
- 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
- ID of the instance that the address is associated with (if any).
- ipam_pool_ strid 
- The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it.
- network_interface_ strid 
- The ID of the network interface.
- network_interface_ strowner_ id 
- The ID of the AWS account that owns the network interface.
- private_dns str
- Private DNS associated with the Elastic IP address.
- private_ip str
- Private IP address associated with the Elastic IP address.
- ptr_record str
- The DNS pointer (PTR) record for the IP address.
- public_dns str
- Public DNS associated with the Elastic IP address.
- public_ip str
- Public IP address of Elastic IP.
- public_ipv4_ strpool 
- ID of an address pool.
- Mapping[str, str]
- Key-value map of tags associated with Elastic IP.
- filters
Sequence[GetElastic Ip Filter] 
- arn String
- associationId String
- ID representing the association of the address with an instance in a VPC.
- carrierIp String
- Carrier IP address.
- customerOwned StringIp 
- Customer Owned IP.
- customerOwned StringIpv4Pool 
- The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
- domain String
- 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
- ID of the instance that the address is associated with (if any).
- ipamPool StringId 
- The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it.
- networkInterface StringId 
- The ID of the network interface.
- networkInterface StringOwner Id 
- The ID of the AWS account that owns the network interface.
- privateDns String
- Private DNS associated with the Elastic IP address.
- privateIp String
- Private IP address associated with the Elastic IP address.
- ptrRecord String
- The DNS pointer (PTR) record for the IP address.
- publicDns String
- Public DNS associated with the Elastic IP address.
- publicIp String
- Public IP address of Elastic IP.
- publicIpv4Pool String
- ID of an address pool.
- Map<String>
- Key-value map of tags associated with Elastic IP.
- filters List<Property Map>
Supporting Types
GetElasticIpFilter   
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.