You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentdb-lambda-java-sam/README.md
+11-16Lines changed: 11 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ Run functions locally and invoke them with the `sam local invoke` command.
73
73
sam local invoke --event events/event.json
74
74
```
75
75
76
-
You should see a response such as the below:
76
+
The following is example test output:
77
77
78
78
```
79
79
***** Begin sam local invoke response *****
@@ -126,9 +126,9 @@ The message "Successfully created/updated stack - <StackName> in <Region>" indic
126
126
127
127
## Test the application
128
128
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.
130
130
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.
132
132
133
133
```
134
134
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
142
142
[ec2-user@ip-10-0-0-126 ~]$ sh ./commands.sh firstBatch 10
143
143
```
144
144
145
-
You should see output similar to what is shown below:
146
-
145
+
The following is sample output:
146
+
```
147
147
Now going to insert a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-1
148
148
Now done inserting a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-1
149
149
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
164
164
Now done inserting a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-9
165
165
Now going to insert a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-10
166
166
Now done inserting a row in DynamoDB for messageID = firstBatch-10-12-2025-08-10-62-10
167
+
```
167
168
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/<NameoftheAWSLambdafunction>
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/<NameoftheAWSLambdafunction>.
170
170
171
171
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
172
172
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.
174
174
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).
176
176
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:
0 commit comments