1. Packages
  2. AWS
  3. API Docs
  4. directconnect
  5. getLocations
AWS v7.5.0 published on Wednesday, Aug 20, 2025 by Pulumi

aws.directconnect.getLocations

Explore with Pulumi AI

aws logo
AWS v7.5.0 published on Wednesday, Aug 20, 2025 by Pulumi

    Retrieve information about the AWS Direct Connect locations in the current AWS Region. These are the locations that can be specified when configuring aws.directconnect.Connection or aws.directconnect.LinkAggregationGroup resources.

    Note: This data source is different from the aws.directconnect.getLocation data source which retrieves information about a specific AWS Direct Connect location in the current AWS Region.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const available = aws.directconnect.getLocations({});
    
    import pulumi
    import pulumi_aws as aws
    
    available = aws.directconnect.get_locations()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/directconnect"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := directconnect.GetLocations(ctx, &directconnect.GetLocationsArgs{}, 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 available = Aws.DirectConnect.GetLocations.Invoke();
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.directconnect.DirectconnectFunctions;
    import com.pulumi.aws.directconnect.inputs.GetLocationsArgs;
    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 available = DirectconnectFunctions.getLocations(GetLocationsArgs.builder()
                .build());
    
        }
    }
    
    variables:
      available:
        fn::invoke:
          function: aws:directconnect:getLocations
          arguments: {}
    

    Using getLocations

    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 getLocations(args: GetLocationsArgs, opts?: InvokeOptions): Promise<GetLocationsResult>
    function getLocationsOutput(args: GetLocationsOutputArgs, opts?: InvokeOptions): Output<GetLocationsResult>
    def get_locations(region: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetLocationsResult
    def get_locations_output(region: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetLocationsResult]
    func GetLocations(ctx *Context, args *GetLocationsArgs, opts ...InvokeOption) (*GetLocationsResult, error)
    func GetLocationsOutput(ctx *Context, args *GetLocationsOutputArgs, opts ...InvokeOption) GetLocationsResultOutput

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

    public static class GetLocations 
    {
        public static Task<GetLocationsResult> InvokeAsync(GetLocationsArgs args, InvokeOptions? opts = null)
        public static Output<GetLocationsResult> Invoke(GetLocationsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLocationsResult> getLocations(GetLocationsArgs args, InvokeOptions options)
    public static Output<GetLocationsResult> getLocations(GetLocationsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:directconnect/getLocations:getLocations
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.

    getLocations Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    LocationCodes List<string>
    Code for the locations.
    Region string
    Id string
    The provider-assigned unique ID for this managed resource.
    LocationCodes []string
    Code for the locations.
    Region string
    id String
    The provider-assigned unique ID for this managed resource.
    locationCodes List<String>
    Code for the locations.
    region String
    id string
    The provider-assigned unique ID for this managed resource.
    locationCodes string[]
    Code for the locations.
    region string
    id str
    The provider-assigned unique ID for this managed resource.
    location_codes Sequence[str]
    Code for the locations.
    region str
    id String
    The provider-assigned unique ID for this managed resource.
    locationCodes List<String>
    Code for the locations.
    region String

    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 v7.5.0 published on Wednesday, Aug 20, 2025 by Pulumi