1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. getEips
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.ec2.getEips

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides a list of Elastic IPs in a region.

    Example Usage

    The following shows outputting all Elastic IPs with the a specific tag value.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.ec2.getEips({
        tags: {
            Env: "dev",
        },
    });
    export const allocationIds = example.then(example => example.allocationIds);
    export const publicIps = example.then(example => example.publicIps);
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.get_eips(tags={
        "Env": "dev",
    })
    pulumi.export("allocationIds", example.allocation_ids)
    pulumi.export("publicIps", example.public_ips)
    
    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 {
    		example, err := ec2.GetEips(ctx, &ec2.GetEipsArgs{
    			Tags: map[string]interface{}{
    				"Env": "dev",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("allocationIds", example.AllocationIds)
    		ctx.Export("publicIps", example.PublicIps)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Ec2.GetEips.Invoke(new()
        {
            Tags = 
            {
                { "Env", "dev" },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["allocationIds"] = example.Apply(getEipsResult => getEipsResult.AllocationIds),
            ["publicIps"] = example.Apply(getEipsResult => getEipsResult.PublicIps),
        };
    });
    
    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.GetEipsArgs;
    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 example = Ec2Functions.getEips(GetEipsArgs.builder()
                .tags(Map.of("Env", "dev"))
                .build());
    
            ctx.export("allocationIds", example.applyValue(getEipsResult -> getEipsResult.allocationIds()));
            ctx.export("publicIps", example.applyValue(getEipsResult -> getEipsResult.publicIps()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:ec2:getEips
          Arguments:
            tags:
              Env: dev
    outputs:
      # VPC EIPs.
      allocationIds: ${example.allocationIds}
      # EC2-Classic EIPs.
      publicIps: ${example.publicIps}
    

    Using getEips

    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 getEips(args: GetEipsArgs, opts?: InvokeOptions): Promise<GetEipsResult>
    function getEipsOutput(args: GetEipsOutputArgs, opts?: InvokeOptions): Output<GetEipsResult>
    def get_eips(filters: Optional[Sequence[GetEipsFilter]] = None,
                 tags: Optional[Mapping[str, str]] = None,
                 opts: Optional[InvokeOptions] = None) -> GetEipsResult
    def get_eips_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetEipsFilterArgs]]]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetEipsResult]
    func GetEips(ctx *Context, args *GetEipsArgs, opts ...InvokeOption) (*GetEipsResult, error)
    func GetEipsOutput(ctx *Context, args *GetEipsOutputArgs, opts ...InvokeOption) GetEipsResultOutput

    > Note: This function is named GetEips in the Go SDK.

    public static class GetEips 
    {
        public static Task<GetEipsResult> InvokeAsync(GetEipsArgs args, InvokeOptions? opts = null)
        public static Output<GetEipsResult> Invoke(GetEipsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetEipsResult> getEips(GetEipsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ec2/getEips:getEips
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetEipsFilter>
    Custom filter block as described below.
    Tags Dictionary<string, string>
    Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    Filters []GetEipsFilter
    Custom filter block as described below.
    Tags map[string]string
    Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    filters List<GetEipsFilter>
    Custom filter block as described below.
    tags Map<String,String>
    Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    filters GetEipsFilter[]
    Custom filter block as described below.
    tags {[key: string]: string}
    Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    filters Sequence[GetEipsFilter]
    Custom filter block as described below.
    tags Mapping[str, str]
    Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.
    filters List<Property Map>
    Custom filter block as described below.
    tags Map<String>
    Map of tags, each pair of which must exactly match a pair on the desired Elastic IPs.

    getEips Result

    The following output properties are available:

    AllocationIds List<string>
    List of all the allocation IDs for address for use with EC2-VPC.
    Id string
    The provider-assigned unique ID for this managed resource.
    PublicIps List<string>
    List of all the Elastic IP addresses.
    Filters List<GetEipsFilter>
    Tags Dictionary<string, string>
    AllocationIds []string
    List of all the allocation IDs for address for use with EC2-VPC.
    Id string
    The provider-assigned unique ID for this managed resource.
    PublicIps []string
    List of all the Elastic IP addresses.
    Filters []GetEipsFilter
    Tags map[string]string
    allocationIds List<String>
    List of all the allocation IDs for address for use with EC2-VPC.
    id String
    The provider-assigned unique ID for this managed resource.
    publicIps List<String>
    List of all the Elastic IP addresses.
    filters List<GetEipsFilter>
    tags Map<String,String>
    allocationIds string[]
    List of all the allocation IDs for address for use with EC2-VPC.
    id string
    The provider-assigned unique ID for this managed resource.
    publicIps string[]
    List of all the Elastic IP addresses.
    filters GetEipsFilter[]
    tags {[key: string]: string}
    allocation_ids Sequence[str]
    List of all the allocation IDs for address for use with EC2-VPC.
    id str
    The provider-assigned unique ID for this managed resource.
    public_ips Sequence[str]
    List of all the Elastic IP addresses.
    filters Sequence[GetEipsFilter]
    tags Mapping[str, str]
    allocationIds List<String>
    List of all the allocation IDs for address for use with EC2-VPC.
    id String
    The provider-assigned unique ID for this managed resource.
    publicIps List<String>
    List of all the Elastic IP addresses.
    filters List<Property Map>
    tags Map<String>

    Supporting Types

    GetEipsFilter

    Name string
    Name of the field to filter by, as defined by the underlying AWS API.
    Values List<string>
    Set of values that are accepted for the given field. An Elastic IP will be selected if any one of the given values matches.
    Name string
    Name of the field to filter by, as defined by the underlying AWS API.
    Values []string
    Set of values that are accepted for the given field. An Elastic IP will be selected if any one of the given values matches.
    name String
    Name of the field to filter by, as defined by the underlying AWS API.
    values List<String>
    Set of values that are accepted for the given field. An Elastic IP will be selected if any one of the given values matches.
    name string
    Name of the field to filter by, as defined by the underlying AWS API.
    values string[]
    Set of values that are accepted for the given field. An Elastic IP will be selected if any one of the given values matches.
    name str
    Name of the field to filter by, as defined by the underlying AWS API.
    values Sequence[str]
    Set of values that are accepted for the given field. An Elastic IP will be selected if any one of the given values matches.
    name String
    Name of the field to filter by, as defined by the underlying AWS API.
    values List<String>
    Set of values that are accepted for the given field. An Elastic IP will be selected if any one of the given values matches.

    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
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi