1. Packages
  2. AWS Classic
  3. API Docs
  4. iam
  5. getAccountAlias

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

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.iam.getAccountAlias

Explore with Pulumi AI

aws logo

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

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

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

    Example Usage

    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);
    
    import pulumi
    import pulumi_aws as aws
    
    current = aws.iam.get_account_alias()
    pulumi.export("accountId", current.account_alias)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    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 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()));
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: aws:iam:getAccountAlias
          Arguments: {}
    outputs:
      accountId: ${current.accountAlias}
    

    Using getAccountAlias

    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 getAccountAlias(opts?: InvokeOptions): Promise<GetAccountAliasResult>
    function getAccountAliasOutput(opts?: InvokeOptions): Output<GetAccountAliasResult>
    def get_account_alias(opts: Optional[InvokeOptions] = None) -> GetAccountAliasResult
    def get_account_alias_output(opts: Optional[InvokeOptions] = None) -> Output[GetAccountAliasResult]
    func LookupAccountAlias(ctx *Context, opts ...InvokeOption) (*LookupAccountAliasResult, error)
    func LookupAccountAliasOutput(ctx *Context, opts ...InvokeOption) LookupAccountAliasResultOutput

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

    public static class GetAccountAlias 
    {
        public static Task<GetAccountAliasResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetAccountAliasResult> Invoke(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
    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.42.0 published on Wednesday, Jun 26, 2024 by Pulumi