URL: turcita.com
This code snippet demonstrates how to set up an base stack. It includes the creation of a Cognito User Pool and a User Pool Client with secure configurations suitable for a Single Page Application (SPA). Also, it outlines the steps to create a VPC, security groups, DynamoDB tables, IAM roles.
export class BaseStack extends Stack { constructor(scope: Construct, id: string, props: AuthStackProps) { super(scope, id, props); // Step 1: Create a VPC and security groups for the Lambda functions // The VPC will provide network isolation for the Lambda functions, ensuring that they can only communicate with each other and not be accessed from the public internet // We will add Gateway Endpoints for S3 and DynamoDB to allow private communication between the Lambda functions and these services without going through the public internet // Step 2: Create DynamoDB tables for the application // We will create several tables to store different types of data, such as stores, professionals, services, appointments, etc. // Each table will have appropriate partition keys and sort keys to optimize query performance based on the access patterns of the application // Step 3: Create a Cognito User Pool // for this step, we will create a user pool with secure configurations, such as: // - Enabling self sign-up with email verification // - Setting password policies (e.g., minimum length, require symbols, etc.) // - Configuring account recovery options // - Enabling multi-factor authentication (MFA) if needed // Step 4: Create Certifications for https // Step 5: Create an IAM roles for the Lambda functions // These role will have permissions to access the DynamoDB tables and the S3 bucket, as well as any other AWS services that the Lambdas need to interact with like cloudwatch for logging. } }