The AmplifyAuth construct is an L3 CDK Construct that simplifies setting up Amazon Cognito for authentication and authorization. It automatically provisions a UserPool, UserPoolClient, IdentityPool, and the necessary Authenticated/Unauthenticated IAM Roles.
Important Limitation: Currently, only a single instance of the AmplifyAuth construct can be invoked within a single CDK synthesis.
import { App, Stack } from 'aws-cdk-lib';
import { AmplifyAuth } from '@aws-amplify/auth-construct';
const app = new App();
const stack = new Stack(app, 'AuthStack');
new AmplifyAuth(stack, 'Auth');