AWS Classic

v5.21.1 published on Thursday, Nov 17, 2022 by Pulumi

getAccountAlias

The IAM Account Alias data source allows access to the account alias for the effective account in which this provider is working.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var current = Aws.Iam.GetAccountAlias.Invoke();

    return new Dictionary<string, object?>
    {
        ["accountId"] = current.Apply(getAccountAliasResult => getAccountAliasResult.AccountAlias),
    };
});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := iam.LookupAccountAlias(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("accountId", current.AccountAlias)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
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 = IamFunctions.getAccountAlias();

        ctx.export("accountId", current.applyValue(getAccountAliasResult -> getAccountAliasResult.accountAlias()));
    }
}
import pulumi
import pulumi_aws as aws

current = aws.iam.get_account_alias()
pulumi.export("accountId", current.account_alias)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.iam.getAccountAlias({});
export const accountId = current.then(current => current.accountAlias);
variables:
  current:
    Fn::Invoke:
      Function: aws:iam:getAccountAlias
      Arguments: {}
outputs:
  accountId: ${current.accountAlias}

Using getAccountAlias

function getAccountAlias(opts?: InvokeOptions): Promise<GetAccountAliasResult>
def get_account_alias(opts: Optional[InvokeOptions] = None) -> GetAccountAliasResult
func LookupAccountAlias(ctx *Context, opts ...InvokeOption) (*LookupAccountAliasResult, error)

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

public static class GetAccountAlias 
{
    public static Task<GetAccountAliasResult> InvokeAsync(InvokeOptions? opts = null)
}
public static CompletableFuture<GetAccountAliasResult> getAccountAlias(InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: aws:iam/getAccountAlias:getAccountAlias
  arguments:
    # arguments dictionary

getAccountAlias Result

The following output properties are available:

AccountAlias string

Alias associated with the AWS account.

Id string

The provider-assigned unique ID for this managed resource.

AccountAlias string

Alias associated with the AWS account.

Id string

The provider-assigned unique ID for this managed resource.

accountAlias String

Alias associated with the AWS account.

id String

The provider-assigned unique ID for this managed resource.

accountAlias string

Alias associated with the AWS account.

id string

The provider-assigned unique ID for this managed resource.

account_alias str

Alias associated with the AWS account.

id str

The provider-assigned unique ID for this managed resource.

accountAlias String

Alias associated with the AWS account.

id String

The provider-assigned unique ID for this managed resource.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.