aws-cdk-lib.aws_cognito.StringAttributeProps

interface StringAttributeProps

LanguageType name
.NETAmazon.CDK.AWS.Cognito.StringAttributeProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscognito#StringAttributeProps
Javasoftware.amazon.awscdk.services.cognito.StringAttributeProps
Pythonaws_cdk.aws_cognito.StringAttributeProps
TypeScript (source)aws-cdk-lib » aws_cognito » StringAttributeProps

Props for constructing a StringAttr.

Example

new cognito.UserPool(this, 'myuserpool', {
  // ...
  standardAttributes: {
    fullname: {
      required: true,
      mutable: false,
    },
    address: {
      required: false,
      mutable: true,
    },
  },
  customAttributes: {
    'myappid': new cognito.StringAttribute({ minLen: 5, maxLen: 15, mutable: false }),
    'callingcode': new cognito.NumberAttribute({ min: 1, max: 3, mutable: true }),
    'isEmployee': new cognito.BooleanAttribute({ mutable: true }),
    'joinedOn': new cognito.DateTimeAttribute(),
  },
});

Properties

NameTypeDescription
maxLen?numberMaximum length of this attribute.
minLen?numberMinimum length of this attribute.
mutable?booleanSpecifies whether the value of the attribute can be changed.

maxLen?

Type: number (optional, default: 2048)

Maximum length of this attribute.


minLen?

Type: number (optional, default: 0)

Minimum length of this attribute.


mutable?

Type: boolean (optional, default: false)

Specifies whether the value of the attribute can be changed.

For any user pool attribute that's mapped to an identity provider attribute, you must set this parameter to true. Amazon Cognito updates mapped attributes when users sign in to your application through an identity provider. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute.