12

If you deploy a UserPool via CloudFormation, e.g:

Resources:
  UserPool:
    Type: 'AWS::Cognito::UserPool'
    Properties:
      ...
      Schema:
        - Name: email
          AttributeDataType: String
          Mutable: true
          Required: true

and then update the attributes to make name required:

Schema:
  - Name: email
    AttributeDataType: String
    Mutable: true
    Required: true
  - Name: name
    AttributeDataType: String
    Mutable: true
    Required: true

AWS thinks that name is a custom attribute and fails with:

Required custom attributes are not supported currently. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: ...)

It's only an update that fails, deploying a clean stack correctly sets both the email and name standard attributes to required.

Is there any way for the update to succeed?

1 Answer 1

10

Unfortunately this is some sort of bug from CloudFormation. Very similar to other issues, for example on the update of DynamoDB tables with more than one index.

The only feasible way to do the update is to do that in two steps:

  1. Remove the attribute that has to be changed (in your case name), deploy the CloudFormation
  2. Add the attribute with the correct values (so adding Require: true in your case), deploy the CloudFormation

As previously said there are quite a lot of issues similar to that case, and you'd better signal your issue to AWS in order to get support and the bug fixed.

2
  • 3
    Thanks, it seems in this case that standard attributes cannot be configured after first deployment of the stack, as any update results in a custom attribute of the same name, so those steps result in the same error.
    – isshesure
    Dec 18, 2019 at 9:48
  • DynamoDB GSI updating behavior is explained a bit here: github.com/aws-cloudformation/…
    – Pat Myron
    Dec 19, 2019 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.