1. Packages
  2. AWS Classic
  3. API Docs
  4. getRegion

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

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

aws.getRegion

Explore with Pulumi AI

aws logo

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

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

    aws.getRegion provides details about a specific AWS region.

    As well as validating a given region name this resource can be used to discover the name of the region configured within the provider. The latter can be useful in a child module which is inheriting an AWS provider configuration from its parent module.

    Example Usage

    The following example shows how the resource might be used to obtain the name of the AWS region configured on the provider.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const current = aws.getRegion({});
    
    import pulumi
    import pulumi_aws as aws
    
    current = aws.get_region()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aws.GetRegion(ctx, nil, 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 current = Aws.GetRegion.Invoke();
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.AwsFunctions;
    import com.pulumi.aws.inputs.GetRegionArgs;
    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 current = AwsFunctions.getRegion();
    
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: aws:getRegion
          Arguments: {}
    

    Using getRegion

    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 getRegion(args: GetRegionArgs, opts?: InvokeOptions): Promise<GetRegionResult>
    function getRegionOutput(args: GetRegionOutputArgs, opts?: InvokeOptions): Output<GetRegionResult>
    def get_region(endpoint: Optional[str] = None,
                   id: Optional[str] = None,
                   name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetRegionResult
    def get_region_output(endpoint: Optional[pulumi.Input[str]] = None,
                   id: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetRegionResult]
    func GetRegion(ctx *Context, args *GetRegionArgs, opts ...InvokeOption) (*GetRegionResult, error)
    func GetRegionOutput(ctx *Context, args *GetRegionOutputArgs, opts ...InvokeOption) GetRegionResultOutput

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

    public static class GetRegion 
    {
        public static Task<GetRegionResult> InvokeAsync(GetRegionArgs args, InvokeOptions? opts = null)
        public static Output<GetRegionResult> Invoke(GetRegionInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRegionResult> getRegion(GetRegionArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:index/getRegion:getRegion
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Endpoint string
    EC2 endpoint of the region to select.
    Id string
    Name string
    Full name of the region to select.
    Endpoint string
    EC2 endpoint of the region to select.
    Id string
    Name string
    Full name of the region to select.
    endpoint String
    EC2 endpoint of the region to select.
    id String
    name String
    Full name of the region to select.
    endpoint string
    EC2 endpoint of the region to select.
    id string
    name string
    Full name of the region to select.
    endpoint str
    EC2 endpoint of the region to select.
    id str
    name str
    Full name of the region to select.
    endpoint String
    EC2 endpoint of the region to select.
    id String
    name String
    Full name of the region to select.

    getRegion Result

    The following output properties are available:

    Description string
    Region's description in this format: "Location (Region name)".
    Endpoint string
    EC2 endpoint for the selected region.
    Id string
    Name string
    Name of the selected region.
    Description string
    Region's description in this format: "Location (Region name)".
    Endpoint string
    EC2 endpoint for the selected region.
    Id string
    Name string
    Name of the selected region.
    description String
    Region's description in this format: "Location (Region name)".
    endpoint String
    EC2 endpoint for the selected region.
    id String
    name String
    Name of the selected region.
    description string
    Region's description in this format: "Location (Region name)".
    endpoint string
    EC2 endpoint for the selected region.
    id string
    name string
    Name of the selected region.
    description str
    Region's description in this format: "Location (Region name)".
    endpoint str
    EC2 endpoint for the selected region.
    id str
    name str
    Name of the selected region.
    description String
    Region's description in this format: "Location (Region name)".
    endpoint String
    EC2 endpoint for the selected region.
    id String
    name String
    Name of the selected region.

    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 v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi