Skip to content

Commit d02bbcd

Browse files
committed
modified readme
1 parent 1f09391 commit d02bbcd

2 files changed

Lines changed: 57 additions & 80 deletions

File tree

README.md

Lines changed: 56 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,13 @@
22

33
This repository deploys a Node.js WebAPI app and a SQL Server database on AWS. It also includes a CI/CD pipeline using GitHub Actions to automate deployment of code changes to the API. The infrastructure is designed to be modular, scalable, and extendable for future enhancements. Lambda was used to host the Node.js WebAPI and the API Gateway exposes HTTP endpoints for the Lambda function.
44

5+
---
56

7+
# Key Features
68

7-
# Table of Contents
8-
9-
1. [Architecture Diagram](#architecture-diagram)
10-
2. [Workflow](#workflow)
11-
3. [Getting Started](#getting-started)
12-
4. [Terraform Infrastructure](#terraform-infrastructure)
13-
14-
15-
16-
# Architecture Diagram
17-
18-
![architecture diagram](<images/lambda.drawio.svg>)
19-
20-
![serverless](images/app.png)
21-
22-
![route2](images/route1.png)
23-
24-
25-
# Workflow
269

2710
This project demonstrates a **serverless Node.js WebAPI** deployed on AWS using **Terraform**.
2811

29-
Running `terraform apply` provisions:
30-
3112
1. **S3 Bucket**
3213
- Stores the deployment ZIP (`deployment.zip`) for Lambda
3314
2. **AWS Lambda Function**
@@ -45,6 +26,54 @@ Running `terraform apply` provisions:
4526
- updates Lambda automatically on code changes
4627

4728

29+
---
30+
31+
# Directory Structure
32+
33+
The AWS infrastructure was organised into reusable modules to build the infrastructure and this approach promotes the DRY (Don't Repeat Yourself) principle and makes your code scalable and maintainable. Terraform was used to provision the infrastructure, with the state backend securely hosted on AWS S3, enabling reliable tracking.
34+
35+
36+
37+
```text
38+
39+
serverless/
40+
├── infra/
41+
│ ├── environments/
42+
│ │ ├── dev/
43+
│ │ │ ├── backend.tf
44+
│ │ │ ├── component.tf
45+
│ │ │ ├── main.tf
46+
│ │ │ ├── oidc.tf
47+
│ │ │ ├── outputs.tf
48+
│ │ │ └── variables.tf
49+
│ │ └── prod/
50+
│ └── modules/
51+
│ ├── api/
52+
│ ├── database/
53+
│ ├── lambda/
54+
│ └── networking/
55+
├── src/
56+
│ └── handler/
57+
│ ├── node_modules/
58+
│ ├── index.js
59+
│ ├── package-lock.json
60+
│ └── package.json
61+
├── .gitignore
62+
├── .pre-commit-config
63+
└── README.md
64+
65+
```
66+
67+
---
68+
69+
# Architecture
70+
71+
![architecture diagram](<images/lambda.drawio.svg>)
72+
73+
---
74+
75+
# Workflow
76+
4877
### API Routes
4978

5079
| Route | Method | Description |
@@ -78,8 +107,9 @@ Running `terraform apply` provisions:
78107
7. Lambda executes a test query
79108
8. API Gateway returns the JSON response to the client.
80109

110+
---
81111

82-
### How code changes are deployed (CI/CD workflow)
112+
# CI/CD Pipeline
83113

84114
When application code is modified and pushed to GitHub, the CI/CD pipeline automatically updates the Lambda function with the latest version of the code. The process works as follows:
85115

@@ -92,64 +122,11 @@ When application code is modified and pushed to GitHub, the CI/CD pipeline autom
92122
5. After the ZIP is uploaded, the workflow calls AWS to update the Lambda function’s code, instructing Lambda to pull the latest ZIP from S3.
93123
6. Lambda immediately switches to the new code, meaning all API Gateway requests (`/` and `/health`) begin using the updated Lambda logic without any downtime.
94124

125+
---
95126

96-
# Getting Started
97-
98-
### Prerequisites
99-
100-
Before using this repository, ensure you have the following installed and configured on your machine:
101-
102-
![Terraform](https://img.shields.io/badge/terraform-%235835CC.svg?style=for-the-badge&logo=terraform&logoColor=white)
103-
![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)
104-
![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)
105-
![AWS](https://img.shields.io/badge/AWS-%23FF9900.svg?style=for-the-badge&logo=amazon-aws&logoColor=white)
106-
107-
### Configure AWS CLI
108-
109-
```bash
110-
$ aws configure
111-
AWS Access Key ID [None]: accesskey
112-
AWS Secret Access Key [None]: secretkey
113-
Default region name [None]: your region
114-
Default output format [None]:
115-
```
116-
127+
### **Here's what it will look like**
117128

118-
# Terraform Infrastructure
119-
120-
The AWS infrastructure was organised into reusable modules to build the infrastructure and this approach promotes the DRY (Don't Repeat Yourself) principle and makes your code scalable and maintainable. Terraform was used to provision the infrastructure, with the state backend securely hosted on AWS S3, enabling reliable tracking.
121-
122-
123-
### Terraform directory
124-
125-
```text
126-
127-
serverless/
128-
├── infra/
129-
│ ├── environments/
130-
│ │ ├── dev/
131-
│ │ │ ├── backend.tf
132-
│ │ │ ├── component.tf
133-
│ │ │ ├── main.tf
134-
│ │ │ ├── oidc.tf
135-
│ │ │ ├── outputs.tf
136-
│ │ │ └── variables.tf
137-
│ │ └── prod/
138-
│ └── modules/
139-
│ ├── api/
140-
│ ├── database/
141-
│ ├── lambda/
142-
│ └── networking/
143-
├── src/
144-
│ └── handler/
145-
│ ├── node_modules/
146-
│ ├── index.js
147-
│ ├── package-lock.json
148-
│ └── package.json
149-
├── .gitignore
150-
├── .pre-commit-config
151-
└── README.md
152-
153-
```
154129

130+
![serverless](images/app.png)
155131

132+
![route2](images/route1.png)

images/lambda.drawio.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)