Skip to content

swb-buildarchetype/space-doodle

Repository files navigation

Welcome to appa Web CDK App

This is a PoC Web Application for appa. It contains:

  • Cognito User Auth Pool
  • Amplify Web Stack
Dashboard Page Analytics Page
Dashboard Analytics

๐Ÿš€ How to deploy

Set cdk context parameters

Visit cdk.context.json and update the following values:

{
  "adminEmail": "enter the admin email address here",
  "projectName": "appaWeb -- you can update or change this project name",
  "deployWebStack": true,
  "deployQuicksightStack": true,
  "quicksightAccountId": "enter quicksight account id here",
  "quicksightDashboard": "enter quicksight dashboard id here"
}

Check prerequisites

For a full summary or prerequisites visit AWS CDK Prerequisites. Please note that to use Quicksight Dashboard integration with this architecture you will need to manually create a Quicksight account and set up Quicksight dashboards using the Quicksight console.

Running this application requires node, aws-cli, and aws cdk

To set up node:

Visit nodejs for directions on installing node for your operating system

To set up aws-cli:

Visit AWS CLI to set up the AWS CLI for your environment

To set up aws cdk:

npm install -g aws-cdk
# if the above command gives you a permissions error
sudo npm install -g aws-cdk

To configure the AWS CLI and assume a role or credentials

aws configure

Deploy

cdk deploy --all

The cdk.json file tells the CDK Toolkit how to execute your app.

What you will build

This application builds the following AWS CDK stacks:

  • WebStack
  • SharedResourcesStack

WebStack

This stack deploys an AWS Amplify application, with a CodeCommit repository that triggers an automatic build and CodePipeline. The Amplify App will be hosted at a dev subdomain. Please note that this domain is ephemeral, so if you destroy the application and rebuild the url will change.

This Stack utilizes the AmplifyDeploy CDK construct and integrates an AWS Cognito User Pool for authorization within the web application. Please note that to add new users you will need to retrieve the AWS Amplify Domain and URL from the AWS Amplify section of the AWS Console. To add new users please follow the instructions for creating Cognito user accounts as an administrator.

SharedResourcesStack

This stack deploys shared resources that are utilized across all stacks. This will currently include an AWS Cognito User Pool built from the CognitoAuth CDK construct

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template