Try AWS Native preview for resources not in the classic version.
aws.cognito.User
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides a Cognito User Resource.
Example Usage
Basic configuration
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cognito.UserPool("example", {name: "MyExamplePool"});
const exampleUser = new aws.cognito.User("example", {
userPoolId: example.id,
username: "example",
});
import pulumi
import pulumi_aws as aws
example = aws.cognito.UserPool("example", name="MyExamplePool")
example_user = aws.cognito.User("example",
user_pool_id=example.id,
username="example")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
Name: pulumi.String("MyExamplePool"),
})
if err != nil {
return err
}
_, err = cognito.NewUser(ctx, "example", &cognito.UserArgs{
UserPoolId: example.ID(),
Username: pulumi.String("example"),
})
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.Cognito.UserPool("example", new()
{
Name = "MyExamplePool",
});
var exampleUser = new Aws.Cognito.User("example", new()
{
UserPoolId = example.Id,
Username = "example",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.UserPool;
import com.pulumi.aws.cognito.UserPoolArgs;
import com.pulumi.aws.cognito.User;
import com.pulumi.aws.cognito.UserArgs;
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) {
var example = new UserPool("example", UserPoolArgs.builder()
.name("MyExamplePool")
.build());
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(example.id())
.username("example")
.build());
}
}
resources:
example:
type: aws:cognito:UserPool
properties:
name: MyExamplePool
exampleUser:
type: aws:cognito:User
name: example
properties:
userPoolId: ${example.id}
username: example
Setting user attributes
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cognito.UserPool("example", {
name: "mypool",
schemas: [
{
name: "example",
attributeDataType: "Boolean",
mutable: false,
required: false,
developerOnlyAttribute: false,
},
{
name: "foo",
attributeDataType: "String",
mutable: false,
required: false,
developerOnlyAttribute: false,
stringAttributeConstraints: {},
},
],
});
const exampleUser = new aws.cognito.User("example", {
userPoolId: example.id,
username: "example",
attributes: {
example: "true",
foo: "bar",
email: "no-reply@example.com",
email_verified: "true",
},
});
import pulumi
import pulumi_aws as aws
example = aws.cognito.UserPool("example",
name="mypool",
schemas=[
{
"name": "example",
"attributeDataType": "Boolean",
"mutable": False,
"required": False,
"developerOnlyAttribute": False,
},
{
"name": "foo",
"attributeDataType": "String",
"mutable": False,
"required": False,
"developerOnlyAttribute": False,
"stringAttributeConstraints": {},
},
])
example_user = aws.cognito.User("example",
user_pool_id=example.id,
username="example",
attributes={
"example": "true",
"foo": "bar",
"email": "no-reply@example.com",
"email_verified": "true",
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
Name: pulumi.String("mypool"),
Schemas: cognito.UserPoolSchemaArray{
&cognito.UserPoolSchemaArgs{
Name: pulumi.String("example"),
AttributeDataType: pulumi.String("Boolean"),
Mutable: pulumi.Bool(false),
Required: pulumi.Bool(false),
DeveloperOnlyAttribute: pulumi.Bool(false),
},
&cognito.UserPoolSchemaArgs{
Name: pulumi.String("foo"),
AttributeDataType: pulumi.String("String"),
Mutable: pulumi.Bool(false),
Required: pulumi.Bool(false),
DeveloperOnlyAttribute: pulumi.Bool(false),
StringAttributeConstraints: nil,
},
},
})
if err != nil {
return err
}
_, err = cognito.NewUser(ctx, "example", &cognito.UserArgs{
UserPoolId: example.ID(),
Username: pulumi.String("example"),
Attributes: pulumi.StringMap{
"example": pulumi.String("true"),
"foo": pulumi.String("bar"),
"email": pulumi.String("no-reply@example.com"),
"email_verified": pulumi.String("true"),
},
})
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.Cognito.UserPool("example", new()
{
Name = "mypool",
Schemas = new[]
{
new Aws.Cognito.Inputs.UserPoolSchemaArgs
{
Name = "example",
AttributeDataType = "Boolean",
Mutable = false,
Required = false,
DeveloperOnlyAttribute = false,
},
new Aws.Cognito.Inputs.UserPoolSchemaArgs
{
Name = "foo",
AttributeDataType = "String",
Mutable = false,
Required = false,
DeveloperOnlyAttribute = false,
StringAttributeConstraints = null,
},
},
});
var exampleUser = new Aws.Cognito.User("example", new()
{
UserPoolId = example.Id,
Username = "example",
Attributes =
{
{ "example", "true" },
{ "foo", "bar" },
{ "email", "no-reply@example.com" },
{ "email_verified", "true" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.UserPool;
import com.pulumi.aws.cognito.UserPoolArgs;
import com.pulumi.aws.cognito.inputs.UserPoolSchemaArgs;
import com.pulumi.aws.cognito.inputs.UserPoolSchemaStringAttributeConstraintsArgs;
import com.pulumi.aws.cognito.User;
import com.pulumi.aws.cognito.UserArgs;
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) {
var example = new UserPool("example", UserPoolArgs.builder()
.name("mypool")
.schemas(
UserPoolSchemaArgs.builder()
.name("example")
.attributeDataType("Boolean")
.mutable(false)
.required(false)
.developerOnlyAttribute(false)
.build(),
UserPoolSchemaArgs.builder()
.name("foo")
.attributeDataType("String")
.mutable(false)
.required(false)
.developerOnlyAttribute(false)
.stringAttributeConstraints()
.build())
.build());
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(example.id())
.username("example")
.attributes(Map.ofEntries(
Map.entry("example", true),
Map.entry("foo", "bar"),
Map.entry("email", "no-reply@example.com"),
Map.entry("email_verified", true)
))
.build());
}
}
resources:
example:
type: aws:cognito:UserPool
properties:
name: mypool
schemas:
- name: example
attributeDataType: Boolean
mutable: false
required: false
developerOnlyAttribute: false
- name: foo
attributeDataType: String
mutable: false
required: false
developerOnlyAttribute: false
stringAttributeConstraints: {}
exampleUser:
type: aws:cognito:User
name: example
properties:
userPoolId: ${example.id}
username: example
attributes:
example: true
foo: bar
email: no-reply@example.com
email_verified: true
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,
user_pool_id: Optional[str] = None,
username: Optional[str] = None,
attributes: Optional[Mapping[str, str]] = None,
client_metadata: Optional[Mapping[str, str]] = None,
desired_delivery_mediums: Optional[Sequence[str]] = None,
enabled: Optional[bool] = None,
force_alias_creation: Optional[bool] = None,
message_action: Optional[str] = None,
password: Optional[str] = None,
temporary_password: Optional[str] = None,
validation_data: Optional[Mapping[str, str]] = None)
func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)
public User(string name, UserArgs args, CustomResourceOptions? opts = null)
type: aws:cognito:User
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
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 awsUserResource = new Aws.Cognito.User("awsUserResource", new()
{
UserPoolId = "string",
Username = "string",
Attributes =
{
{ "string", "string" },
},
ClientMetadata =
{
{ "string", "string" },
},
DesiredDeliveryMediums = new[]
{
"string",
},
Enabled = false,
ForceAliasCreation = false,
MessageAction = "string",
Password = "string",
TemporaryPassword = "string",
ValidationData =
{
{ "string", "string" },
},
});
example, err := cognito.NewUser(ctx, "awsUserResource", &cognito.UserArgs{
UserPoolId: pulumi.String("string"),
Username: pulumi.String("string"),
Attributes: pulumi.StringMap{
"string": pulumi.String("string"),
},
ClientMetadata: pulumi.StringMap{
"string": pulumi.String("string"),
},
DesiredDeliveryMediums: pulumi.StringArray{
pulumi.String("string"),
},
Enabled: pulumi.Bool(false),
ForceAliasCreation: pulumi.Bool(false),
MessageAction: pulumi.String("string"),
Password: pulumi.String("string"),
TemporaryPassword: pulumi.String("string"),
ValidationData: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var awsUserResource = new User("awsUserResource", UserArgs.builder()
.userPoolId("string")
.username("string")
.attributes(Map.of("string", "string"))
.clientMetadata(Map.of("string", "string"))
.desiredDeliveryMediums("string")
.enabled(false)
.forceAliasCreation(false)
.messageAction("string")
.password("string")
.temporaryPassword("string")
.validationData(Map.of("string", "string"))
.build());
aws_user_resource = aws.cognito.User("awsUserResource",
user_pool_id="string",
username="string",
attributes={
"string": "string",
},
client_metadata={
"string": "string",
},
desired_delivery_mediums=["string"],
enabled=False,
force_alias_creation=False,
message_action="string",
password="string",
temporary_password="string",
validation_data={
"string": "string",
})
const awsUserResource = new aws.cognito.User("awsUserResource", {
userPoolId: "string",
username: "string",
attributes: {
string: "string",
},
clientMetadata: {
string: "string",
},
desiredDeliveryMediums: ["string"],
enabled: false,
forceAliasCreation: false,
messageAction: "string",
password: "string",
temporaryPassword: "string",
validationData: {
string: "string",
},
});
type: aws:cognito:User
properties:
attributes:
string: string
clientMetadata:
string: string
desiredDeliveryMediums:
- string
enabled: false
forceAliasCreation: false
messageAction: string
password: string
temporaryPassword: string
userPoolId: string
username: string
validationData:
string: 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
The User resource accepts the following input properties:
- User
Pool stringId - The user pool ID for the user pool where the user will be created.
- Username string
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- Attributes Dictionary<string, string>
- A map that contains user attributes and attribute values to be set for the user.
- Client
Metadata Dictionary<string, string> - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - Desired
Delivery List<string>Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - Enabled bool
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - Force
Alias boolCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - Message
Action string - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - Password string
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - Temporary
Password string - The user's temporary password. Conflicts with
password
. - Validation
Data Dictionary<string, string> The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- User
Pool stringId - The user pool ID for the user pool where the user will be created.
- Username string
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- Attributes map[string]string
- A map that contains user attributes and attribute values to be set for the user.
- Client
Metadata map[string]string - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - Desired
Delivery []stringMediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - Enabled bool
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - Force
Alias boolCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - Message
Action string - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - Password string
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - Temporary
Password string - The user's temporary password. Conflicts with
password
. - Validation
Data map[string]string The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- user
Pool StringId - The user pool ID for the user pool where the user will be created.
- username String
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- attributes Map<String,String>
- A map that contains user attributes and attribute values to be set for the user.
- client
Metadata Map<String,String> - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - desired
Delivery List<String>Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled Boolean
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force
Alias BooleanCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - message
Action String - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - password String
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - temporary
Password String - The user's temporary password. Conflicts with
password
. - validation
Data Map<String,String> The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- user
Pool stringId - The user pool ID for the user pool where the user will be created.
- username string
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- attributes {[key: string]: string}
- A map that contains user attributes and attribute values to be set for the user.
- client
Metadata {[key: string]: string} - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - desired
Delivery string[]Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled boolean
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force
Alias booleanCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - message
Action string - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - password string
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - temporary
Password string - The user's temporary password. Conflicts with
password
. - validation
Data {[key: string]: string} The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- user_
pool_ strid - The user pool ID for the user pool where the user will be created.
- username str
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- attributes Mapping[str, str]
- A map that contains user attributes and attribute values to be set for the user.
- client_
metadata Mapping[str, str] - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - desired_
delivery_ Sequence[str]mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled bool
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force_
alias_ boolcreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - message_
action str - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - password str
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - temporary_
password str - The user's temporary password. Conflicts with
password
. - validation_
data Mapping[str, str] The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- user
Pool StringId - The user pool ID for the user pool where the user will be created.
- username String
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- attributes Map<String>
- A map that contains user attributes and attribute values to be set for the user.
- client
Metadata Map<String> - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - desired
Delivery List<String>Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled Boolean
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force
Alias BooleanCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - message
Action String - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - password String
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - temporary
Password String - The user's temporary password. Conflicts with
password
. - validation
Data Map<String> The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
Outputs
All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:
- Creation
Date string - Id string
- The provider-assigned unique ID for this managed resource.
- Last
Modified stringDate - Mfa
Setting List<string>Lists - Preferred
Mfa stringSetting - Status string
- current user status.
- Sub string
- unique user id that is never reassignable to another user.
- Creation
Date string - Id string
- The provider-assigned unique ID for this managed resource.
- Last
Modified stringDate - Mfa
Setting []stringLists - Preferred
Mfa stringSetting - Status string
- current user status.
- Sub string
- unique user id that is never reassignable to another user.
- creation
Date String - id String
- The provider-assigned unique ID for this managed resource.
- last
Modified StringDate - mfa
Setting List<String>Lists - preferred
Mfa StringSetting - status String
- current user status.
- sub String
- unique user id that is never reassignable to another user.
- creation
Date string - id string
- The provider-assigned unique ID for this managed resource.
- last
Modified stringDate - mfa
Setting string[]Lists - preferred
Mfa stringSetting - status string
- current user status.
- sub string
- unique user id that is never reassignable to another user.
- creation_
date str - id str
- The provider-assigned unique ID for this managed resource.
- last_
modified_ strdate - mfa_
setting_ Sequence[str]lists - preferred_
mfa_ strsetting - status str
- current user status.
- sub str
- unique user id that is never reassignable to another user.
- creation
Date String - id String
- The provider-assigned unique ID for this managed resource.
- last
Modified StringDate - mfa
Setting List<String>Lists - preferred
Mfa StringSetting - status String
- current user status.
- sub String
- unique user id that is never reassignable to another 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,
attributes: Optional[Mapping[str, str]] = None,
client_metadata: Optional[Mapping[str, str]] = None,
creation_date: Optional[str] = None,
desired_delivery_mediums: Optional[Sequence[str]] = None,
enabled: Optional[bool] = None,
force_alias_creation: Optional[bool] = None,
last_modified_date: Optional[str] = None,
message_action: Optional[str] = None,
mfa_setting_lists: Optional[Sequence[str]] = None,
password: Optional[str] = None,
preferred_mfa_setting: Optional[str] = None,
status: Optional[str] = None,
sub: Optional[str] = None,
temporary_password: Optional[str] = None,
user_pool_id: Optional[str] = None,
username: Optional[str] = None,
validation_data: Optional[Mapping[str, 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)
Resource lookup is not supported in YAML
- 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.
- Attributes Dictionary<string, string>
- A map that contains user attributes and attribute values to be set for the user.
- Client
Metadata Dictionary<string, string> - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - Creation
Date string - Desired
Delivery List<string>Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - Enabled bool
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - Force
Alias boolCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - Last
Modified stringDate - Message
Action string - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - Mfa
Setting List<string>Lists - Password string
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - Preferred
Mfa stringSetting - Status string
- current user status.
- Sub string
- unique user id that is never reassignable to another user.
- Temporary
Password string - The user's temporary password. Conflicts with
password
. - User
Pool stringId - The user pool ID for the user pool where the user will be created.
- Username string
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- Validation
Data Dictionary<string, string> The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- Attributes map[string]string
- A map that contains user attributes and attribute values to be set for the user.
- Client
Metadata map[string]string - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - Creation
Date string - Desired
Delivery []stringMediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - Enabled bool
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - Force
Alias boolCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - Last
Modified stringDate - Message
Action string - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - Mfa
Setting []stringLists - Password string
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - Preferred
Mfa stringSetting - Status string
- current user status.
- Sub string
- unique user id that is never reassignable to another user.
- Temporary
Password string - The user's temporary password. Conflicts with
password
. - User
Pool stringId - The user pool ID for the user pool where the user will be created.
- Username string
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- Validation
Data map[string]string The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- attributes Map<String,String>
- A map that contains user attributes and attribute values to be set for the user.
- client
Metadata Map<String,String> - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - creation
Date String - desired
Delivery List<String>Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled Boolean
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force
Alias BooleanCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - last
Modified StringDate - message
Action String - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - mfa
Setting List<String>Lists - password String
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - preferred
Mfa StringSetting - status String
- current user status.
- sub String
- unique user id that is never reassignable to another user.
- temporary
Password String - The user's temporary password. Conflicts with
password
. - user
Pool StringId - The user pool ID for the user pool where the user will be created.
- username String
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- validation
Data Map<String,String> The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- attributes {[key: string]: string}
- A map that contains user attributes and attribute values to be set for the user.
- client
Metadata {[key: string]: string} - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - creation
Date string - desired
Delivery string[]Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled boolean
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force
Alias booleanCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - last
Modified stringDate - message
Action string - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - mfa
Setting string[]Lists - password string
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - preferred
Mfa stringSetting - status string
- current user status.
- sub string
- unique user id that is never reassignable to another user.
- temporary
Password string - The user's temporary password. Conflicts with
password
. - user
Pool stringId - The user pool ID for the user pool where the user will be created.
- username string
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- validation
Data {[key: string]: string} The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- attributes Mapping[str, str]
- A map that contains user attributes and attribute values to be set for the user.
- client_
metadata Mapping[str, str] - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - creation_
date str - desired_
delivery_ Sequence[str]mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled bool
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force_
alias_ boolcreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - last_
modified_ strdate - message_
action str - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - mfa_
setting_ Sequence[str]lists - password str
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - preferred_
mfa_ strsetting - status str
- current user status.
- sub str
- unique user id that is never reassignable to another user.
- temporary_
password str - The user's temporary password. Conflicts with
password
. - user_
pool_ strid - The user pool ID for the user pool where the user will be created.
- username str
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- validation_
data Mapping[str, str] The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
- attributes Map<String>
- A map that contains user attributes and attribute values to be set for the user.
- client
Metadata Map<String> - A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
client_metadata
value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers. - creation
Date String - desired
Delivery List<String>Mediums - A list of mediums to the welcome message will be sent through. Allowed values are
EMAIL
andSMS
. If it's provided, make sure you have also specifiedemail
attribute for theEMAIL
medium andphone_number
for theSMS
. More than one value can be specified. Amazon Cognito does not store thedesired_delivery_mediums
value. Defaults to["SMS"]
. - enabled Boolean
- Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabled
value. The behavior can be changed withmessage_action
argument. Defaults totrue
. - force
Alias BooleanCreation - If this parameter is set to True and the
phone_number
oremail
address specified in theattributes
parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforce_alias_creation
value. Defaults tofalse
. - last
Modified StringDate - message
Action String - Set to
RESEND
to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESS
to suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessage_action
value. - mfa
Setting List<String>Lists - password String
- The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporary_password
value. You can suppress sending the welcome message with themessage_action
argument. Amazon Cognito does not store thepassword
value. Conflicts withtemporary_password
. - preferred
Mfa StringSetting - status String
- current user status.
- sub String
- unique user id that is never reassignable to another user.
- temporary
Password String - The user's temporary password. Conflicts with
password
. - user
Pool StringId - The user pool ID for the user pool where the user will be created.
- username String
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
The following arguments are optional:
- validation
Data Map<String> The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validation_data
value. For more information, see Customizing User Pool Workflows with Lambda Triggers.NOTE: Clearing
password
ortemporary_password
does not reset user's password in Cognito.
Import
Using pulumi import
, import Cognito User using the user_pool_id
/name
attributes concatenated. For example:
$ pulumi import aws:cognito/user:User user us-east-1_vG78M4goG/user
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.
Try AWS Native preview for resources not in the classic version.