Skip to content

Commit 86b5fc0

Browse files
committed
adding architecture diagram, enhancing documentation, fixing CDK
1 parent ab7df8e commit 86b5fc0

4 files changed

Lines changed: 23 additions & 10 deletions

File tree

eventbridge-pipes-sqs-to-dynamodb/README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# SQS to DynamoDB using EventBridge Pipes with API Gateway and CDK/Python
1+
# Amazon SQS to Amazon DynamoDB using Amazon EventBridge Pipes with Amazon API Gateway and CDK/Python
22

33
This pattern will send messages from an SQS queue to a DynamoDB table via API Gateway using EventBridge Pipes.
44

5-
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/eventbridge-pipes-sqs-to-dynamodb
5+
![Architecture](./architecture.png)
6+
7+
Learn more about this pattern at Serverless Land Patterns: [https://serverlessland.com/patterns/eventbridge-pipes-sqs-to-dynamodb](https://serverlessland.com/patterns/eventbridge-pipes-sqs-to-dynamodb)
68

79
Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.
810

@@ -55,21 +57,32 @@ Messages sent to the SQS queue are polled by EventBridge Pipe. EventBridge Pipe
5557

5658
Once this stack is deployed in your AWS account, copy the SQS queue name value from the output.
5759

60+
Alternatively, retrieve the queue URL using AWS CLI:
61+
```sh
62+
aws sqs list-queues --query 'QueueUrls[?contains(@, `EntryPointToEventbridgePipe`)]'
63+
```
64+
5865
Then, send a message to the SQS queue as follows:
5966
```sh
60-
aws sqs send-message \
61-
--queue-url "https://sqs.<region-id>.amazonaws.com/<account-id>/<queue-name>" \
62-
--message-body '{"Message": "{\"content\":\"Test message\",\"params\":{\"name\":\"Mario\",\"surname\":\"Rossi\"}}"}'
67+
aws sqs send-message \
68+
--queue-url "<REPLACE_WITH_OUTPUT_FROM_PREVIOUS_COMMAND>" \
69+
--message-body '{"Message": "{\"content\":\"Test message\",\"params\":{\"name\":\"Mario\",\"surname\":\"Rossi\"}}"}'
6370
```
6471

72+
Navigate to [AWS Console DynamoDB Tables](https://console.aws.amazon.com/dynamodbv2/home#tables) and check for a table with name `Audit-Table`.
6573
When you check the DynamoDB table, you can see the entry with all the attributes parsed by API Gateway.
6674

75+
Alternatively, you can scan the table using AWS CLI:
76+
```sh
77+
aws dynamodb scan --table-name Audit-Table
78+
```
79+
6780
## Cleanup
6881

6982
1. Delete the stack
7083

7184
```bash
72-
cdk destroy
85+
cdk destroy
7386
```
7487

7588
---
28.7 KB
Loading

eventbridge-pipes-sqs-to-dynamodb/eventbridge_pipes_sqs_to_dynamodb/eventbridge_pipes_sqs_to_dynamodb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
class EventbridgePipesSqsToDynamodb(Stack):
1616

17-
def __init__(self, scope: Construct, construct_id: str, env: cdk.Environment, **kwargs) -> None:
17+
def __init__(self, scope: Construct, construct_id: str, env: cdk.Environment = None, **kwargs) -> None:
1818
super().__init__(scope, construct_id, env=env, **kwargs)
1919

20-
# SQS queue for decoupling and buffering events for destination_lambda_b
20+
# SQS queue for decoupling and buffering events
2121
source_queue = sqs.Queue(
2222
self, "EntryPointToEventbridgePipe",
2323
visibility_timeout=cdk.Duration.seconds(60),

eventbridge-pipes-sqs-to-dynamodb/example-pattern.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"title": "SQS to DynamoDB using EventBridge Pipes with API Gateway and CDK Python",
2+
"title": "Amazon SQS to Amazon DynamoDB via Amazon EventBridge Pipes using CDK/Python",
33
"description": "Pattern that sends messages from SQS queue to DynamoDB table via API Gateway using EventBridge Pipes. Implemented with CDK using Python.",
44
"language": "Python",
55
"level": "300",
@@ -23,7 +23,7 @@
2323
"resources": {
2424
"bullets": [
2525
{
26-
"text": "Amazon Simple Queue Service",
26+
"text": "Amazon SQS",
2727
"link": "https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html"
2828
},
2929
{

0 commit comments

Comments
 (0)