I'm using the serverless framework in order to create a Cognito User Pool using the following CloudFormation configuration:
Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
# Generate a name based on the stage
UserPoolName: ${opt:stage}-user-pool
# Set email as an alias
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email
MfaConfiguration: OFF
EmailVerificationMessage: 'message here'
EmailVerificationSubject: 'subject here'
Policies:
PasswordPolicy:
MinimumLength: 6
RequireLowercase: true
RequireNumbers: false
RequireSymbols: true
RequireUppercase: true
Schema:
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: address
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: email
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: family_name
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: gender
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: name
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: phone_number
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: website
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: role
Required: false
EmailConfiguration:
EmailSendingAccount: COGNITO_DEFAULT
# The email is taken from command line arguments, the region and account id through pseudo parameters
SourceArn: "arn:aws:ses:#{AWS::Region}:#{AWS::AccountId}:identity/${env:SES_EMAIL}"
As you can see, the AutoVerifiedAttributes
is set to email; so, Cognito should send the verification code through the email configured in SES. But I'm getting the following error in my CI/CD pipeline: User pool does not have SMS configuration to send messages
. Any hints of why is this happening?
DesiredDeliveryMedium
defaults toSMS
, if you are using CognitoIdentityProvider Boto3 client to calladmin_create_user()
, you must passDesiredDeliveryMedium
as an argument and set the value toemail
such that the invitation email will be sent instead of an SMS. – Loaning