This repo only deploys the infrastructure via Terraform. The source code, this repo, will be deployed automatically via AWS CodePipeline. By default, it's configured to automatically deploy at every push to the master branch.
Check the companion articles series 'OpenAPI' on dev.to.
- Download Terraform v0.12.x here
- You will need Node v12.x from here
- Git, to clone this Repo, from here
- Create a free AWS account (requires credit card) here
- Finally, download the AWS CLI tool
- Setup your AWS local profile, see this guide how it's done.
- Manually setup an AWS S3 Bucket for Terraform state storage.
If you meet all the pre-requisites, do the following
- In your AWS development account create the S3 bucket for your Terraform state files.
- Optionally, encrypt the S3 bucket and enable versioning such that you can do a rollback.
git clone
this repo.- Change your AWS credentials profile name in these files:
./env/dev/remote-backend.tf
./env/dev/dev.tfvars
- Run
npm install
and then executenpm run dev-init
, this will:- Initialize the Terraform project for the 'dev' environment, and synchronize the state with the cloud stored .tfstate file.
- If you run it a second time, it will fail on the workspace creation, this is not an issue (the workspace already exists)
- Run
npm run dev-infra
to prepare the deployment to your AWS account.- Note: this repo contains the node source code that the CodePipeline will deploy to the AWS Lambda and Lambda-layer.
- Confirm with
yes
to deploy, anything else will cancel the deployment
See my full guide on dev.to for more information about this project
ps. I'm aware the gulp file doesn't exit nicely, i'm not an expert. Any pull requests or issue reports with pointers is definitely appreciated.
There are no costs associated with deploying any of this on AWS, there is Free Tier coverage for limited free use.
The following services are deployed with Terraform;
- AWS Cognito
- AWS API Gateway
- AWS Lambda & Lambda Layer
- AWS IAM
- (Added) CloudWatch Alarms, costs will be incurred for enabling Detailed Monitoring for API Gateway (!)
- (Added) AWS CodePipeline, and CodeBuild with Github as source repository. There's a free tier for:
- CodeBuild, 100 build minutes of
build.general1.small
per month. - AWS CodePipeline: 1 free pipeline active per month.
- CodeBuild, 100 build minutes of