1. Registry
  2. Packages
  3. AWS
  4. API Docs
  5. directoryservicedata
  6. User
Viewing docs for AWS v7.51.1
published on Friday, Oct 16, 2026 by Pulumi
aws logo aws logo
Viewing docs for AWS v7.51.1
published on Friday, Oct 16, 2026 by Pulumi

    Manages a user in an AWS Directory Service directory.

    Example Usage

    Basic Usage

    The following example assumes an existing Directory Service directory with Directory Service Data access enabled.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.directoryservicedata.User("example", {
        directoryId: "d-1234567890",
        samAccountName: "exampleuser",
        emailAddress: "exampleuser@example.com",
        givenName: "Example",
        surname: "User",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.directoryservicedata.User("example",
        directory_id="d-1234567890",
        sam_account_name="exampleuser",
        email_address="exampleuser@example.com",
        given_name="Example",
        surname="User")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/directoryservicedata"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := directoryservicedata.NewUser(ctx, "example", &directoryservicedata.UserArgs{
    			DirectoryId:    pulumi.String("d-1234567890"),
    			SamAccountName: pulumi.String("exampleuser"),
    			EmailAddress:   pulumi.String("exampleuser@example.com"),
    			GivenName:      pulumi.String("Example"),
    			Surname:        pulumi.String("User"),
    		})
    		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 = new Aws.DirectoryServiceData.User("example", new()
        {
            DirectoryId = "d-1234567890",
            SamAccountName = "exampleuser",
            EmailAddress = "exampleuser@example.com",
            GivenName = "Example",
            Surname = "User",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.directoryservicedata.User;
    import com.pulumi.aws.directoryservicedata.UserArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            var example = new User("example", UserArgs.builder()
                .directoryId("d-1234567890")
                .samAccountName("exampleuser")
                .emailAddress("exampleuser@example.com")
                .givenName("Example")
                .surname("User")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:directoryservicedata:User
        properties:
          directoryId: d-1234567890
          samAccountName: exampleuser
          emailAddress: exampleuser@example.com
          givenName: Example
          surname: User
    
    pulumi {
      required_providers {
        aws = {
          source = "pulumi/aws"
        }
      }
    }
    
    resource "aws_directoryservicedata_user" "example" {
      directory_id     = "d-1234567890"
      sam_account_name = "exampleuser"
      email_address    = "exampleuser@example.com"
      given_name       = "Example"
      surname          = "User"
    }
    

    Create User Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new User(name: string, args: UserArgs, opts?: CustomResourceOptions);
    @overload
    def User(resource_name: str,
             args: UserArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def User(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             directory_id: Optional[str] = None,
             sam_account_name: Optional[str] = None,
             email_address: Optional[str] = None,
             given_name: Optional[str] = None,
             region: Optional[str] = None,
             surname: Optional[str] = None)
    func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)
    public User(string name, UserArgs args, CustomResourceOptions? opts = null)
    public User(String name, UserArgs args)
    public User(String name, UserArgs args, CustomResourceOptions options)
    
    type: aws:directoryservicedata:User
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "aws_directoryservicedata_user" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var exampleuserResourceResourceFromDirectoryservicedatauser = new Aws.DirectoryServiceData.User("exampleuserResourceResourceFromDirectoryservicedatauser", new()
    {
        DirectoryId = "string",
        SamAccountName = "string",
        EmailAddress = "string",
        GivenName = "string",
        Region = "string",
        Surname = "string",
    });
    
    example, err := directoryservicedata.NewUser(ctx, "exampleuserResourceResourceFromDirectoryservicedatauser", &directoryservicedata.UserArgs{
    	DirectoryId:    pulumi.String("string"),
    	SamAccountName: pulumi.String("string"),
    	EmailAddress:   pulumi.String("string"),
    	GivenName:      pulumi.String("string"),
    	Region:         pulumi.String("string"),
    	Surname:        pulumi.String("string"),
    })
    
    resource "aws_directoryservicedata_user" "exampleuserResourceResourceFromDirectoryservicedatauser" {
      lifecycle {
        create_before_destroy = true
      }
      directory_id     = "string"
      sam_account_name = "string"
      email_address    = "string"
      given_name       = "string"
      region           = "string"
      surname          = "string"
    }
    
    var exampleuserResourceResourceFromDirectoryservicedatauser = new com.pulumi.aws.directoryservicedata.User("exampleuserResourceResourceFromDirectoryservicedatauser", com.pulumi.aws.directoryservicedata.UserArgs.builder()
        .directoryId("string")
        .samAccountName("string")
        .emailAddress("string")
        .givenName("string")
        .region("string")
        .surname("string")
        .build());
    
    exampleuser_resource_resource_from_directoryservicedatauser = aws.directoryservicedata.User("exampleuserResourceResourceFromDirectoryservicedatauser",
        directory_id="string",
        sam_account_name="string",
        email_address="string",
        given_name="string",
        region="string",
        surname="string")
    
    const exampleuserResourceResourceFromDirectoryservicedatauser = new aws.directoryservicedata.User("exampleuserResourceResourceFromDirectoryservicedatauser", {
        directoryId: "string",
        samAccountName: "string",
        emailAddress: "string",
        givenName: "string",
        region: "string",
        surname: "string",
    });
    
    type: aws:directoryservicedata:User
    properties:
        directoryId: string
        emailAddress: string
        givenName: string
        region: string
        samAccountName: string
        surname: string
    

    User Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The User resource accepts the following input properties:

    DirectoryId string
    ID of the Directory that's associated with the user.
    SamAccountName string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    EmailAddress string
    Email address of the user.
    GivenName string
    First name of the user.
    Region string
    Region where the user is managed. Defaults to the provider region.
    Surname string
    Last name of the user.
    DirectoryId string
    ID of the Directory that's associated with the user.
    SamAccountName string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    EmailAddress string
    Email address of the user.
    GivenName string
    First name of the user.
    Region string
    Region where the user is managed. Defaults to the provider region.
    Surname string
    Last name of the user.
    directory_id string
    ID of the Directory that's associated with the user.
    sam_account_name string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    email_address string
    Email address of the user.
    given_name string
    First name of the user.
    region string
    Region where the user is managed. Defaults to the provider region.
    surname string
    Last name of the user.
    directoryId String
    ID of the Directory that's associated with the user.
    samAccountName String

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    emailAddress String
    Email address of the user.
    givenName String
    First name of the user.
    region String
    Region where the user is managed. Defaults to the provider region.
    surname String
    Last name of the user.
    directoryId string
    ID of the Directory that's associated with the user.
    samAccountName string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    emailAddress string
    Email address of the user.
    givenName string
    First name of the user.
    region string
    Region where the user is managed. Defaults to the provider region.
    surname string
    Last name of the user.
    directory_id str
    ID of the Directory that's associated with the user.
    sam_account_name str

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    email_address str
    Email address of the user.
    given_name str
    First name of the user.
    region str
    Region where the user is managed. Defaults to the provider region.
    surname str
    Last name of the user.
    directoryId String
    ID of the Directory that's associated with the user.
    samAccountName String

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    emailAddress String
    Email address of the user.
    givenName String
    First name of the user.
    region String
    Region where the user is managed. Defaults to the provider region.
    surname String
    Last name of the user.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:

    DistinguishedName string
    Distinguished name of the user.
    Enabled bool
    Whether the user is active.
    Id string
    The provider-assigned unique ID for this managed resource.
    Realm string
    Realm of the user.
    Sid string
    Unique Security identifier (SID) of the user.
    UserPrincipalName string
    User principal name of the user.
    DistinguishedName string
    Distinguished name of the user.
    Enabled bool
    Whether the user is active.
    Id string
    The provider-assigned unique ID for this managed resource.
    Realm string
    Realm of the user.
    Sid string
    Unique Security identifier (SID) of the user.
    UserPrincipalName string
    User principal name of the user.
    distinguished_name string
    Distinguished name of the user.
    enabled bool
    Whether the user is active.
    id string
    The provider-assigned unique ID for this managed resource.
    realm string
    Realm of the user.
    sid string
    Unique Security identifier (SID) of the user.
    user_principal_name string
    User principal name of the user.
    distinguishedName String
    Distinguished name of the user.
    enabled Boolean
    Whether the user is active.
    id String
    The provider-assigned unique ID for this managed resource.
    realm String
    Realm of the user.
    sid String
    Unique Security identifier (SID) of the user.
    userPrincipalName String
    User principal name of the user.
    distinguishedName string
    Distinguished name of the user.
    enabled boolean
    Whether the user is active.
    id string
    The provider-assigned unique ID for this managed resource.
    realm string
    Realm of the user.
    sid string
    Unique Security identifier (SID) of the user.
    userPrincipalName string
    User principal name of the user.
    distinguished_name str
    Distinguished name of the user.
    enabled bool
    Whether the user is active.
    id str
    The provider-assigned unique ID for this managed resource.
    realm str
    Realm of the user.
    sid str
    Unique Security identifier (SID) of the user.
    user_principal_name str
    User principal name of the user.
    distinguishedName String
    Distinguished name of the user.
    enabled Boolean
    Whether the user is active.
    id String
    The provider-assigned unique ID for this managed resource.
    realm String
    Realm of the user.
    sid String
    Unique Security identifier (SID) of the user.
    userPrincipalName String
    User principal name of the user.

    Look up Existing User Resource

    Get an existing User resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: UserState, opts?: CustomResourceOptions): User
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            directory_id: Optional[str] = None,
            distinguished_name: Optional[str] = None,
            email_address: Optional[str] = None,
            enabled: Optional[bool] = None,
            given_name: Optional[str] = None,
            realm: Optional[str] = None,
            region: Optional[str] = None,
            sam_account_name: Optional[str] = None,
            sid: Optional[str] = None,
            surname: Optional[str] = None,
            user_principal_name: Optional[str] = None) -> User
    func GetUser(ctx *Context, name string, id IDInput, state *UserState, opts ...ResourceOption) (*User, error)
    public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)
    public static User get(String name, Output<String> id, UserState state, CustomResourceOptions options)
    resources:  _:    type: aws:directoryservicedata:User    get:      id: ${id}
    import {
      to = aws_directoryservicedata_user.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DirectoryId string
    ID of the Directory that's associated with the user.
    DistinguishedName string
    Distinguished name of the user.
    EmailAddress string
    Email address of the user.
    Enabled bool
    Whether the user is active.
    GivenName string
    First name of the user.
    Realm string
    Realm of the user.
    Region string
    Region where the user is managed. Defaults to the provider region.
    SamAccountName string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    Sid string
    Unique Security identifier (SID) of the user.
    Surname string
    Last name of the user.
    UserPrincipalName string
    User principal name of the user.
    DirectoryId string
    ID of the Directory that's associated with the user.
    DistinguishedName string
    Distinguished name of the user.
    EmailAddress string
    Email address of the user.
    Enabled bool
    Whether the user is active.
    GivenName string
    First name of the user.
    Realm string
    Realm of the user.
    Region string
    Region where the user is managed. Defaults to the provider region.
    SamAccountName string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    Sid string
    Unique Security identifier (SID) of the user.
    Surname string
    Last name of the user.
    UserPrincipalName string
    User principal name of the user.
    directory_id string
    ID of the Directory that's associated with the user.
    distinguished_name string
    Distinguished name of the user.
    email_address string
    Email address of the user.
    enabled bool
    Whether the user is active.
    given_name string
    First name of the user.
    realm string
    Realm of the user.
    region string
    Region where the user is managed. Defaults to the provider region.
    sam_account_name string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    sid string
    Unique Security identifier (SID) of the user.
    surname string
    Last name of the user.
    user_principal_name string
    User principal name of the user.
    directoryId String
    ID of the Directory that's associated with the user.
    distinguishedName String
    Distinguished name of the user.
    emailAddress String
    Email address of the user.
    enabled Boolean
    Whether the user is active.
    givenName String
    First name of the user.
    realm String
    Realm of the user.
    region String
    Region where the user is managed. Defaults to the provider region.
    samAccountName String

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    sid String
    Unique Security identifier (SID) of the user.
    surname String
    Last name of the user.
    userPrincipalName String
    User principal name of the user.
    directoryId string
    ID of the Directory that's associated with the user.
    distinguishedName string
    Distinguished name of the user.
    emailAddress string
    Email address of the user.
    enabled boolean
    Whether the user is active.
    givenName string
    First name of the user.
    realm string
    Realm of the user.
    region string
    Region where the user is managed. Defaults to the provider region.
    samAccountName string

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    sid string
    Unique Security identifier (SID) of the user.
    surname string
    Last name of the user.
    userPrincipalName string
    User principal name of the user.
    directory_id str
    ID of the Directory that's associated with the user.
    distinguished_name str
    Distinguished name of the user.
    email_address str
    Email address of the user.
    enabled bool
    Whether the user is active.
    given_name str
    First name of the user.
    realm str
    Realm of the user.
    region str
    Region where the user is managed. Defaults to the provider region.
    sam_account_name str

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    sid str
    Unique Security identifier (SID) of the user.
    surname str
    Last name of the user.
    user_principal_name str
    User principal name of the user.
    directoryId String
    ID of the Directory that's associated with the user.
    distinguishedName String
    Distinguished name of the user.
    emailAddress String
    Email address of the user.
    enabled Boolean
    Whether the user is active.
    givenName String
    First name of the user.
    realm String
    Realm of the user.
    region String
    Region where the user is managed. Defaults to the provider region.
    samAccountName String

    SAM account name of the user. Must contain only word characters, hyphens, and periods.

    The following arguments are optional:

    sid String
    Unique Security identifier (SID) of the user.
    surname String
    Last name of the user.
    userPrincipalName String
    User principal name of the user.

    Import

    Identity Schema

    Required

    • directoryId (String) ID of the Directory Service directory where the user is managed.
    • samAccountName (String) SAM account name of the user.

    Optional

    • accountId (String) AWS Account where this resource is managed.
    • region (String) Region where this resource is managed.

    Using pulumi import, import Directory Service Data User using the directory ID and SAM account name separated by a comma. For example:

    $ pulumi import aws:directoryservicedata/user:User example d-1234567890,exampleuser
    

    To learn more about importing existing cloud resources, see Importing resources.

    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 aws logo
    Viewing docs for AWS v7.51.1
    published on Friday, Oct 16, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial