Skip to content

Commit 169030f

Browse files
committed
More docs
1 parent b97d5b7 commit 169030f

File tree

3 files changed

+44
-17
lines changed

3 files changed

+44
-17
lines changed

examples/powertools-examples-parameters/README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ This project contains an example of Lambda function using the parameters module
44

55
The example uses the [SSM Parameter Store](https://docs.powertools.aws.dev/lambda/java/utilities/parameters/#ssm-parameter-store)
66
and the [Secrets Manager](https://docs.powertools.aws.dev/lambda/java/utilities/parameters/#secrets-manager) to inject
7-
runtime parameters into the application.
8-
7+
runtime parameters into the application.
98
Have a look at [ParametersFunction.java](src/main/java/org/demo/parameters/ParametersFunction.java) for the full details.
109

1110
## Deploy the sample application
@@ -15,3 +14,25 @@ started with SAM in [the examples directory](../README.md)
1514

1615
## Test the application
1716

17+
First, hit the URL of the application. You can do this with curl or your browser:
18+
19+
```bash
20+
curl https://[REST-API-ID].execute-api.[REGION].amazonaws.com/Prod/params/
21+
```
22+
You will get your IP address back. The contents of the logs will be more interesting, and show you the values
23+
of the parameters injected into the handler:
24+
25+
```bash
26+
sam logs --stack-name $MY_STACK_NAME --tail
27+
```
28+
29+
```json
30+
{
31+
...
32+
"thread": "main",
33+
"level": "INFO",
34+
"loggerName": "org.demo.parameters.ParametersFunction",
35+
"message": "secretjsonobj=MyObject{id=23443, code='hk38543oj24kn796kp67bkb234gkj679l68'}\n",
36+
...
37+
}
38+
```

examples/powertools-examples-parameters/template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Resources:
1919
Handler: org.demo.parameters.ParametersFunction::handleRequest
2020
MemorySize: 512
2121
Tracing: Active
22-
# Environment:
23-
# Variables:
24-
# LOG_LEVEL: INFO
22+
Environment:
23+
Variables:
24+
LOG_LEVEL: INFO
2525
Policies:
2626
- AWSSecretsManagerGetSecretValuePolicy:
2727
SecretArn: !Ref UserPwd

examples/powertools-examples-serialization/README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22

33
This project contains an example of Lambda function using the serialization utilities module of Powertools for AWS Lambda (Java). For more information on this module, please refer to the [documentation](https://docs.powertools.aws.dev/lambda-java/utilities/serialization/).
44

5-
## Deploy the sample application
5+
The project contains two `RequestHandler`s -
6+
7+
* [APIGatewayRequestDeserializationFunction](src/main/java/org/demo/serialization/APIGatewayRequestDeserializationFunction.java) - Uses the serialization library to deserialize an API Gateway request body
8+
* [SQSEventDeserializationFunction](src/main/java/org/demo/serialization/SQSEventDeserializationFunction.java) - Uses the serialization library to deserialize an SQS message body
9+
10+
In both cases, the output of the serialized message will be printed to the function logs. The message format
11+
in JSON looks like this:
612

7-
This sample is based on Serverless Application Model (SAM) and you can use the SAM Command Line Interface (SAM CLI) to build it and deploy it to AWS.
13+
```json
14+
{
15+
"id":1234,
16+
"name":"product",
17+
"price":42
18+
}
19+
```
820

9-
To use the SAM CLI, you need the following tools.
21+
## Deploy the sample application
1022

11-
* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
12-
* Java11 - [Install the Java 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
13-
* Maven - [Install Maven](https://maven.apache.org/install.html)
14-
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
23+
This sample is based on Serverless Application Model (SAM). To deploy it, check out the instructions for getting
24+
started with SAM in [the examples directory](../README.md)
1525

16-
To build and deploy your application for the first time, run the following in your shell:
26+
## Test the application
1727

18-
```bash
19-
sam build
20-
sam deploy --guided
21-
```

0 commit comments

Comments
 (0)