This is a template repo to get you started building services from a common baseline.
This repo implements:
- Frontend (Cloudfront - modify the contents of
/web/publicto update the frontend) - Lambda (API - modify
/api/src/routes.tsto build an API) - AWS CLoud Development Kit (CDK) infrastructure as code
- Scloud constructs
- Scloud Github Actions integration
Prerequisites
- Either a domain name with an existing zone in Route53, or the ability to update name servers for a domain to point to a new zone file you'll create in Route53. A working domain is required to provision SSL certificates.
- A Github personal access token with "repo" permissions
Setup
- Clone this repo, rename the directory and change the remote to the repo you're setting up
- run
./setup.shto generate and set up a template CDK infrastructure (the CDK stack will be named to match the name of the current directory) - edit the generated
*.shfiles under.infrastructure/secrets/to set the domain name (and optionally zone ID if using a pre-existing zone) Github details (including personal access token) - If your AWS account already has an OpenID Connect provider (e.g. if other stacks are deployed to this account) you will need to comment out the
githubActions(this).ghaOidcProvider();line in.infrastructure/lib/*-stack.ts. You can check if there's already a provider by going to IAM -> (left menu) Access Management -> Identity providers. If there's an entry fortoken.actions.githubusercontent.comthen you'll need to comment out the line in the stack code. The provider enables keyless login from Github Actions to AWS for deployment. - From the
.infrastructuredirectory run./deploy.shto deploy the infrastructure - Once you're up and running,
/setup.shand the/setupdirecory can be deleted
Development
- Make the changes you need
- Check in and push to Github
- Check the build runs successfully via the "Actions" tab on Github
- Your changes should now be deployed to AWS and visible via your domain over https