Skip to content

Display embedded quicksight dashboard using Cognito connected user

Notifications You must be signed in to change notification settings

mboisnard/aws-quicksight-cognito

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quicksight-Cognito

Quicksight Cognito lambda configured to display Quicksight Dashboard inside web application without Amplify black magic.

Technologies: API Gateway V2, S3 bucket, Quicksight, Cognito, IAM, CloudFront, CloudWatch, CloudFormation, Javascript Lambda, React webApp with Amplify library

Lambda dependencies: AWS SDK v3, @vendia/serverless-express, Babel + Webpack

WebApp dependencies: React, @aws-amplify/ui-react, amazon-quicksight-embedding-sdk

Infrastructure

Infrastructure

How to deploy this infrastructure?

  1. Create a Quicksight Enterprise account (this cannot be created by Cloudformation :/)
  2. Deploy Cloudformation stack with this yaml file
  3. Build webapp & lambda codes
    $ cd web && yarn install && yarn build
    $ cd ../lambda && yarn install && yarn build
    
  4. Deploy built code using CLI or manually
    1. Retrieve CI User Access Key information in CloudFormation stack output & configure your CLI to use it (aws configure)
    2. Execute CLI commands
    $ cd web && aws s3 cp ./build/ s3://quicksight-cognito-web-app-s3 --recursive
    $ cd ../lambda && aws lambda update-function-code --function-name quicksight-cognito-lambda --zip-file fileb://lambda.zip --publish
    
  5. Configure Quicksight to allow your frontend domain url to display an embedded dashboard
    1. Retrieve your domain name in Cloudformation stack output
    2. Go to Domains & Integration in Quicksight and add your domain name to the list
  6. Create Quicksight Dashboard & and complete Lambda QUICKSIGHT_DASHBOARD_ID environment variable with dashboard id

Environment variables used by Lambda code

  • COGNITO_IDENTITY_POOL_ID (configured by Cloudformation)

  • COGNITO_USER_POOL_URL (configured by Cloudformation)

  • STS_ROLE_ARN_TO_ASSUME (configured by Cloudformation)

  • QUICKSIGHT_REGION (configured by Cloudformation)

  • QUICKSIGHT_DASHBOARD_ID (configured manually)

  • AWS_ACCOUNT_ID (configured by Cloudformation)

  • AWS_REGION (configured by Cloudformation)

Documentation