Repository navigation
[2024.12 and 2024.12.01] Regex failure when registering a new Cognito user
xiangshn edited this page Jan 15, 2025
·
1 revision
Attempting to register AWS Cognito users through the web portal with email prefixes containing “.” such as <firstname>.<lastname>@<company>.com will result in an error that the Cognito username does not match the defined regex pattern.

This error is caused by RES auto-generating usernames from the user’s email prefix. However, usernames with “.” are not valid users for VDIs in certain Linux distributions supported by RES. This fix removes any “.” in the email prefix when generating a username to allow the username to be valid on a RES Linux VDIs.
This issue affects RES versions 2024.12 and 2024.12.01
- Download patch.py and cognito_sign_up_email_fix.patch for version 2024.12 or cognito_sign_up_email_fix.patch for version 2024.12.01 by replacing
<output-directory>with the directory to download the patch script and patch file and<environment-name>with the name of your RES environment in the command below: a. The patch applies to RES 2024.12 and 2024.12.01. b. The patch script requires AWS CLI v2, Python 3.9.16 or above, and Boto3. c. Configure the AWS CLI for the account / region where RES is deployed, and make sure that you have S3 permissions to write to the bucket created by RES.
OUTPUT_DIRECTORY=<output-directory>
ENVIRONMENT_NAME=<environment-name>
RES_VERSION=<res-version> # either 2024.12 or 2024.12.01
mkdir -p ${OUTPUT_DIRECTORY}
curl https://research-engineering-studio-us-east-1.s3.amazonaws.com/releases/${RES_VERSION}/patch_scripts/patch.py --output ${OUTPUT_DIRECTORY}/patch.py
curl https://research-engineering-studio-us-east-1.s3.amazonaws.com/releases/${RES_VERSION}/patch_scripts/patches/cognito_sign_up_email_fix.patch --output ${OUTPUT_DIRECTORY}/cognito_sign_up_email_fix.patch
- Navigate to the directory where the patch script and patch file are downloaded. Run the following patch command:
python3 ${OUTPUT_DIRECTORY}/patch.py --environment-name ${ENVIRONMENT_NAME} --res-version ${RES_VERSION} --module cluster-manager --patch ${OUTPUT_DIRECTORY}/cognito_sign_up_email_fix.patch
- Restart the Cluster Manager instance for your environment. You may also terminate the instance from the Amazon EC2 Management Console.
INSTANCE_ID=$(aws ec2 describe-instances \
--filters \
Name=tag:Name,Values=${ENVIRONMENT_NAME}-cluster-manager \
Name=tag:res:EnvironmentName,Values=${ENVIRONMENT_NAME}\
--query "Reservations[0].Instances[0].InstanceId" \
--output text)
aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}
- Verify the Cluster Manager instance status by checking the activity of the auto scaling group starting with the name
<RES-EnvironmentName>-cluster-manager-asg. Wait until the new instance is launched successfully.