User Pool Args
Provides a Cognito User Pool resource.
Example Usage
Basic configuration
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.UserPool;
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 pool = new UserPool("pool");
}
}
Enabling SMS and Software Token Multi-Factor Authentication
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.UserPoolSmsConfigurationArgs;
import com.pulumi.aws.cognito.inputs.UserPoolSoftwareTokenMfaConfigurationArgs;
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()
.mfaConfiguration("ON")
.smsAuthenticationMessage("Your code is {####}")
.smsConfiguration(UserPoolSmsConfigurationArgs.builder()
.externalId("example")
.snsCallerArn(aws_iam_role.example().arn())
.snsRegion("us-east-1")
.build())
.softwareTokenMfaConfiguration(UserPoolSoftwareTokenMfaConfigurationArgs.builder()
.enabled(true)
.build())
.build());
}
}
Using Account Recovery Setting
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.UserPoolAccountRecoverySettingArgs;
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 test = new UserPool("test", UserPoolArgs.builder()
.accountRecoverySetting(UserPoolAccountRecoverySettingArgs.builder()
.recoveryMechanisms(
UserPoolAccountRecoverySettingRecoveryMechanismArgs.builder()
.name("verified_email")
.priority(1)
.build(),
UserPoolAccountRecoverySettingRecoveryMechanismArgs.builder()
.name("verified_phone_number")
.priority(2)
.build())
.build())
.build());
}
}
Import
Cognito User Pools can be imported using the id
, e.g.,
$ pulumi import aws:cognito/userPool:UserPool pool us-west-2_abc123
Constructors
Properties
Configuration block to define which verified available method a user can use to recover their forgotten password. Detailed below.
Configuration block for creating a new user profile. Detailed below.
Attributes supported as an alias for this user pool. Valid values: phone_number
, email
, or preferred_username
. Conflicts with username_attributes
.
Attributes to be auto-verified. Valid values: email
, phone_number
.
When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature. Valid values are ACTIVE
and INACTIVE
, Default value is INACTIVE
.
Configuration block for the user pool's device tracking. Detailed below.
Configuration block for configuring email. Detailed below.
String representing the email verification message. Conflicts with verification_message_template
configuration block email_message
argument.
String representing the email verification subject. Conflicts with verification_message_template
configuration block email_subject
argument.
Configuration block for the AWS Lambda triggers associated with the user pool. Detailed below.
Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of OFF
. Valid values are OFF
(MFA Tokens are not required), ON
(MFA is required for all users to sign in; requires at least one of sms_configuration
or software_token_mfa_configuration
to be configured), or OPTIONAL
(MFA Will be required only for individual users who have MFA Enabled; requires at least one of sms_configuration
or software_token_mfa_configuration
to be configured).
Configuration blocked for information about the user pool password policy. Detailed below.
Configuration block for the schema attributes of a user pool. Detailed below. Schema attributes from the standard attribute set only need to be specified if they are different from the default configuration. Attributes can be added, but not modified or removed. Maximum of 50 attributes.
String representing the SMS authentication message. The Message must contain the {####}
placeholder, which will be replaced with the code.
Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection.
String representing the SMS verification message. Conflicts with verification_message_template
configuration block sms_message
argument.
Configuration block for software token Mult-Factor Authentication (MFA) settings. Detailed below.
Configuration block for user attribute update settings. Detailed below.
Whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with alias_attributes
.
Configuration block for username configuration. Detailed below.
Configuration block for user pool add-ons to enable user pool advanced security mode features. Detailed below.
Configuration block for verification message templates. Detailed below.