AWS v6.71.0 published on Friday, Mar 7, 2025 by Pulumi
aws.iam.getUser
Explore with Pulumi AI
This data source can be used to fetch information about a specific IAM user. By using this data source, you can reference IAM user properties without having to hard code ARNs or unique IDs as input.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.iam.getUser({
    userName: "an_example_user_name",
});
import pulumi
import pulumi_aws as aws
example = aws.iam.get_user(user_name="an_example_user_name")
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 {
		_, err := iam.LookupUser(ctx, &iam.LookupUserArgs{
			UserName: "an_example_user_name",
		}, 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 example = Aws.Iam.GetUser.Invoke(new()
    {
        UserName = "an_example_user_name",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetUserArgs;
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 example = IamFunctions.getUser(GetUserArgs.builder()
            .userName("an_example_user_name")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:iam:getUser
      arguments:
        userName: an_example_user_name
Using getUser
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 getUser(args: GetUserArgs, opts?: InvokeOptions): Promise<GetUserResult>
function getUserOutput(args: GetUserOutputArgs, opts?: InvokeOptions): Output<GetUserResult>def get_user(tags: Optional[Mapping[str, str]] = None,
             user_name: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetUserResult
def get_user_output(tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
             user_name: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]func LookupUser(ctx *Context, args *LookupUserArgs, opts ...InvokeOption) (*LookupUserResult, error)
func LookupUserOutput(ctx *Context, args *LookupUserOutputArgs, opts ...InvokeOption) LookupUserResultOutput> Note: This function is named LookupUser in the Go SDK.
public static class GetUser 
{
    public static Task<GetUserResult> InvokeAsync(GetUserArgs args, InvokeOptions? opts = null)
    public static Output<GetUserResult> Invoke(GetUserInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
public static Output<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
fn::invoke:
  function: aws:iam/getUser:getUser
  arguments:
    # arguments dictionaryThe following arguments are supported:
- UserName string
- Friendly IAM user name to match.
- Dictionary<string, string>
- Map of key-value pairs associated with the user.
- UserName string
- Friendly IAM user name to match.
- map[string]string
- Map of key-value pairs associated with the user.
- userName String
- Friendly IAM user name to match.
- Map<String,String>
- Map of key-value pairs associated with the user.
- userName string
- Friendly IAM user name to match.
- {[key: string]: string}
- Map of key-value pairs associated with the user.
- user_name str
- Friendly IAM user name to match.
- Mapping[str, str]
- Map of key-value pairs associated with the user.
- userName String
- Friendly IAM user name to match.
- Map<String>
- Map of key-value pairs associated with the user.
getUser Result
The following output properties are available:
- Arn string
- ARN assigned by AWS for this user.
- Id string
- The provider-assigned unique ID for this managed resource.
- Path string
- Path in which this user was created.
- PermissionsBoundary string
- The ARN of the policy that is used to set the permissions boundary for the user.
- Dictionary<string, string>
- Map of key-value pairs associated with the user.
- UserId string
- Unique ID assigned by AWS for this user.
- UserName string
- Name associated to this User
- Arn string
- ARN assigned by AWS for this user.
- Id string
- The provider-assigned unique ID for this managed resource.
- Path string
- Path in which this user was created.
- PermissionsBoundary string
- The ARN of the policy that is used to set the permissions boundary for the user.
- map[string]string
- Map of key-value pairs associated with the user.
- UserId string
- Unique ID assigned by AWS for this user.
- UserName string
- Name associated to this User
- arn String
- ARN assigned by AWS for this user.
- id String
- The provider-assigned unique ID for this managed resource.
- path String
- Path in which this user was created.
- permissionsBoundary String
- The ARN of the policy that is used to set the permissions boundary for the user.
- Map<String,String>
- Map of key-value pairs associated with the user.
- userId String
- Unique ID assigned by AWS for this user.
- userName String
- Name associated to this User
- arn string
- ARN assigned by AWS for this user.
- id string
- The provider-assigned unique ID for this managed resource.
- path string
- Path in which this user was created.
- permissionsBoundary string
- The ARN of the policy that is used to set the permissions boundary for the user.
- {[key: string]: string}
- Map of key-value pairs associated with the user.
- userId string
- Unique ID assigned by AWS for this user.
- userName string
- Name associated to this User
- arn str
- ARN assigned by AWS for this user.
- id str
- The provider-assigned unique ID for this managed resource.
- path str
- Path in which this user was created.
- permissions_boundary str
- The ARN of the policy that is used to set the permissions boundary for the user.
- Mapping[str, str]
- Map of key-value pairs associated with the user.
- user_id str
- Unique ID assigned by AWS for this user.
- user_name str
- Name associated to this User
- arn String
- ARN assigned by AWS for this user.
- id String
- The provider-assigned unique ID for this managed resource.
- path String
- Path in which this user was created.
- permissionsBoundary String
- The ARN of the policy that is used to set the permissions boundary for the user.
- Map<String>
- Map of key-value pairs associated with the user.
- userId String
- Unique ID assigned by AWS for this user.
- userName String
- Name associated to this User
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.