/nodejs-api-aws-terraform-gha

Repository used in presentation about cloud development

Primary LanguageHCLApache License 2.0Apache-2.0

Badges

.github/workflows/release.yaml License

nodejs-api-aws-terraform-gha

This project is a sample NodeJS API with Typescript, and is being used to demonstrate the process of developing and deploying an application to production.

Tech Stack

Server: Node, Express, Typescript, Jest

Infrastructure-as-Code: Terragrunt, Terraform

CI/CD: Github Actions

Cloud: AWS

Cloud Resources: ECS, ECR, Load Balancers, VPC, Route53, Cloudwatch, IAM

Run Locally

Clone the project

  git clone https://github.com/sonikro/nodejs-api-aws-terraform-gha.git

Go to the project directory

  cd nodejs-api-aws-terraform-gha

Install dependencies

  yarn

Start the server

  yarn start

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PORT | Default to 8080

Running Tests

To run tests, run the following command

  yarn test

API Reference

Get all customers

  GET /customer

Create a Customer

  POST /customer
  {
		"id": "1",
		"email": "some@email.com",
		"name": "Some name"
  }
Parameter Type Description
body json Customer being added

Integration between Github and AWS

To connect your runner to your AWS Account, you need to setup an OIDC in AWS to allow your repository to assume a specific role. For more information, see https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services

⚠️ Deploying this to your AWS Account will incur costs: