Restricting Users to Specific Domains in AWS Cognito

  • Published
  • Posted in AWS
  • Updated
  • 1 min read
  • Tagged as

If you want to restrict access to your AWS Cognito user pool to only a specific company’s domain, you can follow these steps:

Step 1. Create a Lambda function that allows access to the desired company domain.

Restricting Users to Specific Domains in AWS Cognito | Addend Analytics-1

Step 2. Assuming you have already created the Cognito User Pool, add a lambda trigger in the User Pool properties.

Restricting Users to Specific Domains in AWS Cognito | Addend Analytics-2

Step 3. Select “sign-up” as the trigger type and choose “pre-signup”.

Restricting Users to Specific Domains in AWS Cognito | Addend Analytics-3

Step 4. Provide the Lambda function and add the trigger.

Restricting Users to Specific Domains in AWS Cognito | Addend Analytics-4

Step 5. Test the setup by checking the hosted UI and attempting to use a domain that should not be accessible. You should receive an error if access is restricted..

Restricting Users to Specific Domains in AWS Cognito | Addend Analytics-5

By implementing these steps, you can ensure that only users with email addresses from the specified company domain can access your Cognito user pool, providing an added layer of security and control.

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.