Skip to content

Commit e3fb986

Browse files
Feat(docs): Add Full Tutorial Page for Terraform Serverless Shipment App (HacktoberFest) (#265)
Co-authored-by: blkgrlcto <kiah@c-trax.com>
1 parent d17c37c commit e3fb986

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
title: "Tutorial: Terraform Fullstack Serverless Shipment App"
3+
description: "Deploy a full-stack shipment tracking application locally using Terraform and LocalStack."
4+
services:
5+
- agw
6+
- lmb
7+
- ddb
8+
- s3
9+
platform:
10+
- Terraform
11+
- Node.js
12+
deployment:
13+
- terraform
14+
- awscli
15+
pro: false
16+
leadimage: "banner.png"
17+
---
18+
19+
[LocalStack](https://localstack.cloud) enables you to develop and test cloud applications locally by emulating AWS services on your machine. In this tutorial, you will deploy a full-stack serverless shipment tracking application using Terraform and LocalStack.
20+
21+
This sample app consists of a React frontend and a Spring Boot backend, integrating with key AWS services like API Gateway, Lambda, DynamoDB, S3, SNS, and SQS. The infrastructure is managed entirely using Terraform, demonstrating Infrastructure as Code (IaC) workflows.
22+
23+
![Terraform Fullstack Serverless Shipment App Architecture](https://github.com/localstack-samples/sample-terraform-fullstack-serverless-shipment-app/raw/master/sample-pictures/architecture.png)
24+
25+
## Prerequisites
26+
27+
Make sure the following tools and dependencies are installed and configured on your local machine before proceeding:
28+
29+
- **LocalStack** (preferably Team or Pro edition for advanced features)
30+
- **Terraform CLI**
31+
- **AWS CLI** with the [awslocal](https://docs.localstack.cloud/aws/integrations/aws-native-tools/aws-cli/#localstack-aws-cli-awslocal) wrapper for LocalStack
32+
- **Maven 3.8.5+** and **Java 17** for Spring Boot backend
33+
- **Node.js** and **npm** for React frontend
34+
- **make** (optional, but recommended for simplified commands)
35+
36+
## Installation
37+
38+
Clone the sample repository and install dependencies:
39+
40+
```
41+
git clone https://github.com/localstack-samples/sample-terraform-fullstack-serverless-shipment-app.git
42+
cd sample-terraform-fullstack-serverless-shipment-app
43+
44+
make install
45+
```
46+
47+
This command builds the Lambda validator JAR and installs frontend Node.js packages.
48+
49+
## Deployment
50+
51+
Start LocalStack in the background with your authorization token configured:
52+
53+
```
54+
localstack auth set-token <your-auth-token>
55+
localstack start -d
56+
```
57+
58+
Use the provided Makefile to deploy all infrastructure components:
59+
60+
```
61+
make deploy
62+
```
63+
64+
This creates and configures:
65+
66+
- S3 buckets for shipment images and Lambda code
67+
- DynamoDB tables preloaded with sample shipments
68+
- Lambda functions for image validation and processing
69+
- SNS topics and SQS queues for event messaging
70+
- Required IAM roles and permissions
71+
72+
## Running the Application
73+
74+
### Start React Frontend
75+
76+
```
77+
cd shipment-list-frontend
78+
npm start
79+
```
80+
81+
Access the UI at [http://localhost:3000](http://localhost:3000).
82+
83+
### Start Spring Boot Backend
84+
85+
In a separate terminal, run:
86+
87+
```
88+
mvn spring-boot:run -Dspring-boot.run.profiles=dev
89+
```
90+
91+
The backend API will be available at [http://localhost:8081](http://localhost:8081).
92+
93+
## Testing
94+
95+
Run full end-to-end tests with:
96+
97+
```
98+
make test
99+
```
100+
101+
## Using the Application
102+
103+
- View shipment list on the React frontend.
104+
- Upload shipment images; valid ones are watermarked by the Lambda function.
105+
- Invalid files are automatically replaced.
106+
- Real-time updates are delivered via Server-Sent Events.
107+
- Create, update, or delete shipments through provided UI and API endpoints.
108+
109+
## Summary and Use Cases
110+
111+
This project illustrates:
112+
113+
- Deploying AWS resources (S3, Lambda, DynamoDB, SNS, SQS) with Terraform.
114+
- Serverless image processing and validation using Lambda.
115+
- Reactive messaging using SNS and SQS.
116+
- Seamless switching between AWS and LocalStack via Spring Profiles.
117+
- Integration testing using Testcontainers.
118+
- Using LocalStack CLI wrappers (`awslocal`, `tflocal`) for streamlined local development.
119+
- Infrastructure as Code testing enabling consistent, repeatable environment setups.
120+
121+
122+
---
123+
124+
By completing this tutorial, you can confidently develop and test complex serverless applications locally with LocalStack and Terraform, accelerating your cloud-native development cycles.

0 commit comments

Comments
 (0)