An example of deploying AWS-native services with CDK and GitHub Actions.
- VPC
- API Gateway
- Lambda function triggered by API gateway
- Load-balanced containerized application running on Fargate
Uses CDK to describe our infrastructure as code.
Builds a docker image that is deployed to Fargate behind an ALB.
Demonstrates how to use GitHub actions with OIDC authentication as recommended by AWS for a CI/CD pipeline.
Uses Serverless Stack to provide live local lambda development.
Shared typescript library in packages/core
.
Node 18 is recommended.
npm i -g pnpm
pnpm i
Follow these instructions.
To configure CI/CD you will need to create a role for GitHub Actions to authenticate as.
- Edit
.env
and set your GitHub org - Deploy to your dev environment:
pnpm deploy:dev
- Copy the value of the
CICD ROLE:
stack output ARN to.github/workflows/deploy.yml
underDEV_AWS_ROLE
- this will let your GitHub action authenticate with OIDC to AWS.
Push to master
to deploy to the dev
environment, push to the prod
branch to deploy to production.
Seed is a great tool for deploying CDK and SST apps to AWS.
You will want to edit these files for your setup:
sst.config.ts
- can configure default regions, AWS profiles, stacks to deploy, app name.env
- configure your GitHub org for GitHub action authenticationstacks/
- infrastructure lives in here