AWS Classic
Pulumi Official

Package maintained by Pulumiv5.9.2 published on Friday, Jun 24, 2022 by Pulumi
getCallerIdentity
Use this data source to get the access to the effective Account ID, User ID, and ARN in which this provider is authorized.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var current = Output.Create(Aws.GetCallerIdentity.InvokeAsync());
this.AccountId = current.Apply(current => current.AccountId);
this.CallerArn = current.Apply(current => current.Arn);
this.CallerUser = current.Apply(current => current.UserId);
}
[Output("accountId")]
public Output<string> AccountId { get; set; }
[Output("callerArn")]
public Output<string> CallerArn { get; set; }
[Output("callerUser")]
public Output<string> CallerUser { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := aws.GetCallerIdentity(ctx, nil, nil)
if err != nil {
return err
}
ctx.Export("accountId", current.AccountId)
ctx.Export("callerArn", current.Arn)
ctx.Export("callerUser", current.UserId)
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var current = Output.of(AwsFunctions.getCallerIdentity());
ctx.export("accountId", current.apply(getCallerIdentityResult -> getCallerIdentityResult.accountId()));
ctx.export("callerArn", current.apply(getCallerIdentityResult -> getCallerIdentityResult.arn()));
ctx.export("callerUser", current.apply(getCallerIdentityResult -> getCallerIdentityResult.userId()));
}
}
import pulumi
import pulumi_aws as aws
current = aws.get_caller_identity()
pulumi.export("accountId", current.account_id)
pulumi.export("callerArn", current.arn)
pulumi.export("callerUser", current.user_id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const current = aws.getCallerIdentity({});
export const accountId = current.then(current => current.accountId);
export const callerArn = current.then(current => current.arn);
export const callerUser = current.then(current => current.userId);
variables:
current:
Fn::Invoke:
Function: aws:getCallerIdentity
Arguments: {}
outputs:
accountId: ${current.accountId}
callerArn: ${current.arn}
callerUser: ${current.userId}
Using getCallerIdentity
function getCallerIdentity(opts?: InvokeOptions): Promise<GetCallerIdentityResult>
def get_caller_identity(opts: Optional[InvokeOptions] = None) -> GetCallerIdentityResult
func GetCallerIdentity(ctx *Context, opts ...InvokeOption) (*GetCallerIdentityResult, error)
> Note: This function is named GetCallerIdentity
in the Go SDK.
public static class GetCallerIdentity
{
public static Task<GetCallerIdentityResult> InvokeAsync(InvokeOptions? opts = null)
}
public static CompletableFuture<GetCallerIdentityResult> getCallerIdentity(InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: aws:index/getCallerIdentity:getCallerIdentity
Arguments:
# Arguments dictionary
getCallerIdentity Result
The following output properties are available:
- account_
id str AWS Account ID number of the account that owns or contains the calling entity.
- arn str
ARN associated with the calling entity.
- id str
The provider-assigned unique ID for this managed resource.
- user_
id str Unique identifier of the calling entity.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.