Skip to content

Commit 881c5ef

Browse files
committed
add sample app readme
1 parent 4c77c8d commit 881c5ef

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## API Gateway + Lambda Sample Application
2+
3+
The directory contains the source code and the Infrastructure as Code (IaC) to create the sample app in your AWS account.
4+
5+
### Prerequisite
6+
Before you begin, ensure you have the following installed:
7+
- Java 17
8+
- Gradle
9+
- Terraform
10+
- AWS CLI configured with appropriate credentials
11+
12+
### Getting Started
13+
14+
#### 1. Build the application
15+
```bash
16+
# Change to the project directory
17+
cd sample-apps/apigateway-lambda
18+
19+
# Build the application using Gradle
20+
gradle clean build
21+
22+
# Prepare the Lambda deployment package
23+
gradle createLambdaZip
24+
```
25+
26+
#### 2. Deploy the application
27+
```bash
28+
# Change to the terraform directory
29+
cd terraform
30+
31+
# Initialize Terraform
32+
terraform init
33+
34+
# (Optional) Review the deployment plan for better understanding of the components
35+
terraform plan
36+
37+
# Deploy
38+
terraform apply
39+
```
40+
41+
#### 3. Testing the applicating
42+
After successful deployment, Terraform will output the API Gateway endpoint URL. You can test the application using:
43+
```bash
44+
curl <API_Gateway_URL>
45+
```
46+
47+
#### 4. Clean Up
48+
To avoid incurring unnecessary charges, remember to destroy the resources when you are done:
49+
```bash
50+
terraform destroy
51+
```
52+
53+
#### (Optional) Instrumenting with Application Signals Lambda Layer
54+
You can choose to instrument the Lambda function with Application Signals Lambda Layer upon deployment by passing in the layer ARN to the `adot_layer_arn` variable.
55+
You must have the layer already published to your account before executing the following command.
56+
```bash
57+
terraform apply -var "adot_layer_arn=<APPLICATION_SIGNALS_LAYER_FULL_ARN_WITH_VERSION>"
58+
```

0 commit comments

Comments
 (0)