get Region
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({});
Content copied to clipboard
import pulumi
import pulumi_aws as aws
current = aws.get_region()
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var current = Aws.GetRegion.Invoke();
});
Content copied to clipboard
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, &aws.GetRegionArgs{}, nil)
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
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();
}
}
Content copied to clipboard
variables:
current:
fn::invoke:
function: aws:getRegion
arguments: {}
Content copied to clipboard
Return
A collection of values returned by getRegion.
Parameters
argument
A collection of arguments for invoking getRegion.
suspend fun getRegion(endpoint: String? = null, id: String? = null, name: String? = null): GetRegionResult
Return
A collection of values returned by getRegion.
Parameters
endpoint
EC2 endpoint of the region to select.
id
name
Full name of the region to select.
See also
Return
A collection of values returned by getRegion.
Parameters
argument
Builder for com.pulumi.aws.kotlin.inputs.GetRegionPlainArgs.