Project template for using aws-cdk, Chalice and React in concert, including RDS Postgresql and AWS Cognito

Overview

What is This?

This repository is an opinonated project template for using aws-cdk, Chalice and React in concert. Where aws-cdk and Chalice are in Python and React is in Javascript. The idea is to quickly build an API in Python with Chalice, deploy it easily with aws-cdk, and then access resources through a React frontend app including user authentication via AWS Cognito.

This is still under active development but some steps towards a full integration are done. It can be developed and run locally via docker compose. Infrastructure and Chalice deployments are still seperate and some copy and pasta is necessary to pass runtime parameters to the right places, but the aim is to have it fully integrated at some point.

The cognito user pool is not part of the infractructure (aws-cdk), yet, and has to be created manually, e.g. in the web UI.

The following files need to be edited with custom AWS parameters and some renamed:

backend/.chalice/config_sample.json
backend/.chalice/policy_sample.json
backend/app.py # cognito ids
backend/cli.py # cognito ids

frontend/env.development.local_sample
frontend/env.production.local_sample

Things still Todo:

  • Figure out how to run the create table command after deployment
  • Create Todo list CRUD backend
  • Create Todo list CRUD frontend
  • Integrate Chalice into aws-cdk code, using from chalice.cdk import Chalice

Checkout cheatsheet.md for some useful CLI commands.

Quickstart

First, you'll need to install the AWS CDK if you haven't already. The CDK requires Node.js and npm to run.

$ npm install -g aws-cdk

Next you'll need to install the requirements for the project.

$ pip install -r requirements.txt

There's also separate requirements files in the infrastructure and backend directories if you'd prefer to have separate virtual environments for your CDK and Chalice app.

To deploy the application, cd to the infrastructure directory. If this is you're first time using the CDK you'll need to bootstrap your environment.

$ cdk bootstrap

Then you can deploy your infrastructure using the CDK.

$ cdk deploy

Now cd into the backend folder and then you can deploy your application using Chalice.

$ chalice deploy --stage prod

Node deployment

Now cd into the frontend folder

DOCKER_BUILDKIT=1 docker build -f Dockerfile.build --output . .

aws s3api create-bucket --bucket my_bucket --region moon-east-1 --create-bucket-configuration LocationConstraint=moon-central-1

aws s3 sync ./build s3://my_bucket

aws s3 website s3://my_bucket --index-document index.html --error-document error.html

Project layout

This project template combines a CDK application, a Chalice application and a React application.

These correspond to the infrastructure, backend and frontend directory, respectively. To run any CDK CLI commands, ensure you're in the infrastructure directory, to run any Chalice CLI commands ensure you're in the backend directory, and to run React CLI commands ensure you are in the frontend directory.

You might also like...
This repository contains code written in the AWS Cloud Development Kit (CDK)
This repository contains code written in the AWS Cloud Development Kit (CDK)

This repository contains code written in the AWS Cloud Development Kit (CDK) which launches infrastructure across two different regions to demonstrate using AWS AppSync in a multi-region setup.

DIAL(Did I Alert Lambda?) is a centralised security misconfiguration detection framework which completely runs on AWS Managed services like AWS API Gateway, AWS Event Bridge & AWS Lambda
DIAL(Did I Alert Lambda?) is a centralised security misconfiguration detection framework which completely runs on AWS Managed services like AWS API Gateway, AWS Event Bridge & AWS Lambda

DIAL(Did I Alert Lambda?) is a centralised security misconfiguration detection framework which completely runs on AWS Managed services like AWS API Gateway, AWS Event Bridge & AWS Lambda

The algorithm performs a simple user registration (Name, CPF, E-mail and Telephone) in an Amazon RDS database and also performs the storage, training and facial recognition of the user's face to identify the users already registered in the system in a next time the user is seen. Multi-Branch CI/CD Pipeline using CDK Pipelines.
Multi-Branch CI/CD Pipeline using CDK Pipelines.

Using AWS CDK Pipelines and AWS Lambda for multi-branch pipeline management and infrastructure deployment. This project shows how to use the AWS CDK P

Implement backup and recovery with AWS Backup across your AWS Organizations using a CI/CD pipeline (AWS CodePipeline).
Implement backup and recovery with AWS Backup across your AWS Organizations using a CI/CD pipeline (AWS CodePipeline).

Backup and Recovery with AWS Backup This repository provides you with a management and deployment solution for implementing Backup and Recovery with A

AHA is an incident management & communication framework to provide real-time alert customers when there are active AWS event(s). For customers with AWS Organizations, customers can get aggregated active account level events of all the accounts in the Organization. Customers not using AWS Organizations still benefit alerting at the account level.
Create CDK projects with projen

The Projenator: I'll be back! Description This is a CDKv2 project that takes the grind out of setting up new cdk projects/implementations by using aut

Pincer-bot-template - A template for a Discord bot created using the Pincer library

Pincer Discord Bot Template (Python) WARNING: Pincer is still in its alpha/plann

Automated AWS account hardening with AWS Control Tower and AWS Step Functions
Automated AWS account hardening with AWS Control Tower and AWS Step Functions

Automate activities in Control Tower provisioned AWS accounts Table of contents Introduction Architecture Prerequisites Tools and services Usage Clean

Owner
Rasmus Jones
Rasmus Jones
Cdk-python-crud-app - CDK Python CRUD App

Welcome to your CDK Python project! You should explore the contents of this proj

Shapon Sheikh 1 Jan 12, 2022
AWS Blog post code for running feature-extraction on images using AWS Batch and Cloud Development Kit (CDK).

Batch processing with AWS Batch and CDK Welcome This repository demostrates provisioning the necessary infrastructure for running a job on AWS Batch u

AWS Samples 7 Oct 18, 2022
Demo to explain how to use AWS Chalice to connect to twitter API and change profile picture at scheduled times.

chalice-twitter-demo Demo to explain how to use AWS Chalice to connect to twitter API and change profile picture at scheduled times. Video Demo Click

Ahmed Mohamed 4 Dec 13, 2021
A solution designed to extract, transform and load Chicago crime data from an RDS instance to other services in AWS.

This project is intended to implement a solution designed to extract, transform and load Chicago crime data from an RDS instance to other services in AWS.

Yesaswi Avula 1 Feb 4, 2022
Bancos de Dados Relacionais (SQL) na AWS com Amazon RDS

Bancos de Dados Relacionais (SQL) na AWS com Amazon RDS Repositório para o Live Coding DIO do dia 24/11/2021 Serviços utilizados Amazon RDS AWS Lambda

Cassiano Ricardo de Oliveira Peres 4 Jul 30, 2022
Bancos de Dados Relacionais (SQL) na AWS com Amazon RDS.

Bancos de Dados Relacionais (SQL) na AWS com Amazon RDS Explorando o Amazon RDS, um serviço de provisionamente e gerenciamento de banco de dados relac

Lucas Magalhães 1 Dec 5, 2021
Recommended AWS CDK project structure for Python applications

Recommended AWS CDK project structure for Python applications The project implements a user management backend component that uses Amazon API Gateway,

AWS Samples 110 Jan 6, 2023
Deploy a STAC API and a dynamic mosaic tiler API using AWS CDK.

Earth Observation API Deploy a STAC API and a dynamic mosaic tiler API using AWS CDK.

Development Seed 39 Oct 30, 2022
This solution helps you deploy Data Lake Infrastructure on AWS using CDK Pipelines.

CDK Pipelines for Data Lake Infrastructure Deployment This solution helps you deploy data lake infrastructure on AWS using CDK Pipelines. This is base

AWS Samples 66 Nov 23, 2022
Criando Lambda Functions para Ingerir Dados de APIs com AWS CDK

LIVE001 - AWS Lambda para Ingerir Dados de APIs Fazer o deploy de uma função lambda com infraestrutura como código Lambda vai numa API externa e extra

Andre Sionek 12 Nov 20, 2022