Skip to content

Commit 190ef8f

Browse files
authored
minor edits
1 parent c7b815a commit 190ef8f

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

documentdb-lambda-java-sam/README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Run functions locally and invoke them with the `sam local invoke` command.
7373
sam local invoke --event events/event.json
7474
```
7575

76-
You should see a response such as the below:
76+
The following is example test output:
7777

7878
```
7979
***** Begin sam local invoke response *****
@@ -126,9 +126,9 @@ The message "Successfully created/updated stack - <StackName> in <Region>" indic
126126

127127
## Test the application
128128

129-
Once the lambda function is deployed, send some Amazon DocumentDB Streams messages by inputting documents in the Database and Collection that have been configured on the lambda function's event listener.
129+
After deployment, create documents in the Collection to generate stream records.
130130

131-
For your convenience, a Java program and a shell script has been created on the EC2 machine that was provisioned using Cloudformation.
131+
For your convenience, a Java program and a shell script are included on the EC2 instance provisioned by CloudFormation.
132132

133133
```
134134
cd /home/ec2-user/serverless-patterns/documentdb-lambda-java-sam/documentdb_streams_message_sender_json
@@ -142,8 +142,8 @@ You should see a script called commands.sh. Run that script by passing a random
142142
[ec2-user@ip-10-0-0-126 ~]$ sh ./commands.sh firstBatch 10
143143
```
144144

145-
You should see output similar to what is shown below:
146-
145+
The following is sample output:
146+
```
147147
Now going to insert a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-1
148148
Now done inserting a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-1
149149
Now going to insert a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-2
@@ -164,31 +164,26 @@ Now going to insert a row in DynamoDB for messageID = firstBatch-10-12-2025-08-1
164164
Now done inserting a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-9
165165
Now going to insert a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-10
166166
Now done inserting a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-10
167+
```
167168

168-
169-
Once the messages have been sent, check Amazon Cloudwatch Logs and you should see messages for the Amazon Cloudwatch Log Group with the name of the deployed AWS Lambda function. The name of the Amazon Cloudwatch Log Group is /aws/lambda/<Name of the AWS Lambda function>
169+
After sending the messages, check Amazon CloudWatch Logs for the AWS Lambda function. The name of the Amazon Cloudwatch Log Group is /aws/lambda/<Name of the AWS Lambda function>.
170170

171171
When you run the above script, it inputs JSON records into the Amazon DocumentDB cluster in the database and collection that were created. This results in the Amazon DocumentDB streams publishing every document. The AWS Lambda function listens on the published Amazon DocumentDB streams messages
172172

173-
The AWS Lambda code parses the Amazon DocumentDB streams messages and outputs the fields in the messages to Amazon Cloudwatch logs.
173+
The AWS Lambda function parses the Amazon DocumentDB streams messages and outputs the fields to Amazon Cloudwatch logs.
174174

175-
The lambda function also inputs each record into a Amazon DynamoDB table called DocumentDBStreamsConsumerDynamoDBTableJava (if you did not modify the default name in the sam template.yaml file)
175+
The function also writes each record into a Amazon DynamoDB table named DocumentDBStreamsConsumerDynamoDBTableJava (if you did not modify the default name in the sam template.yaml file).
176176

177-
You can go to the Amazon DynamoDB console and view the records.
178-
179-
You can also use the aws cli command below to view the count of records inserted into Amazon DynamoDB
177+
You can view the records using the Amazon DynamoDB console, or use the following aws cli command:
180178

181179
```
182180
aws dynamodb scan --table-name DocumentDBStreamsConsumerDynamoDBTableJava --select "COUNT"
183181
184182
```
185183

186-
187-
188184
## Cleanup
189185

190-
You can first clean-up the AWS Lambda function by running `sam delete`
191-
186+
First, delete the lambda function stack:
192187
```
193188
cd /home/ec2-user/serverless-patterns/documentdb-lambda-java-sam/documentdb_streams_consumer_dynamo_sam
194189
sam delete

0 commit comments

Comments
 (0)