New serverless pattern - eventbridge-pipes-sqs-to-dynamodb#2950
New serverless pattern - eventbridge-pipes-sqs-to-dynamodb#2950mscarimb wants to merge 1 commit intoaws-samples:mainfrom
Conversation
|
|
||
| class EventbridgePipesSqsToDynamodb(Stack): | ||
|
|
||
| def __init__(self, scope: Construct, construct_id: str, env: cdk.Environment, **kwargs) -> None: |
There was a problem hiding this comment.
| def __init__(self, scope: Construct, construct_id: str, env: cdk.Environment, **kwargs) -> None: | |
| def __init__(self, scope: Construct, construct_id: str, env: cdk.Environment = None, **kwargs) -> None: |
I got
❯ cdk synth
Traceback (most recent call last):
File ".../serverless-patterns-guardian/serverless-patterns/eventbridge-pipes-sqs-to-dynamodb/app.py", line 7, in <module>
stack = EventbridgePipesSqsToDynamodb(app, "EventbridgePipesSqsToDynamodb")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../serverless-patterns-guardian/serverless-patterns/eventbridge-pipes-sqs-to-dynamodb/.venv/lib/python3.12/site-packages/jsii/_runtime.py", line 118, in __call__
inst = super(JSIIMeta, cast(JSIIMeta, cls)).__call__(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: EventbridgePipesSqsToDynamodb.__init__() missing 1 required positional argument: 'env'
python3 app.py: Subprocess exited with error 1
There was a problem hiding this comment.
With the complexity of the architecture (number of services), pls add a brief architecture diagram visualizing the flow/architecture.
No architecture diagram showing the flow from SQS → EventBridge Pipes → API Gateway → DynamoDB.
| @@ -0,0 +1,79 @@ | |||
| # SQS to DynamoDB using EventBridge Pipes with API Gateway and CDK/Python | |||
There was a problem hiding this comment.
| # SQS to DynamoDB using EventBridge Pipes with API Gateway and CDK/Python | |
| # Amazon SQS to Amazon DynamoDB using Amazon EventBridge Pipes with Amazon API Gateway and CDK/Python |
| "resources": { | ||
| "bullets": [ | ||
| { | ||
| "text": "Amazon Simple Queue Service", |
There was a problem hiding this comment.
| "text": "Amazon Simple Queue Service", | |
| "text": "Amazon SQS", |
| @@ -0,0 +1,65 @@ | |||
| { | |||
| "title": "SQS to DynamoDB using EventBridge Pipes with API Gateway and CDK Python", | |||
There was a problem hiding this comment.
Update the title with full qualified Services names as in readme.md.
Potential rewrite needed - 75 characters limit in the title
|
|
||
| This pattern will send messages from an SQS queue to a DynamoDB table via API Gateway using EventBridge Pipes. | ||
|
|
||
| Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/eventbridge-pipes-sqs-to-dynamodb |
There was a problem hiding this comment.
| Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/eventbridge-pipes-sqs-to-dynamodb | |
| 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) |
| --message-body '{"Message": "{\"content\":\"Test message\",\"params\":{\"name\":\"Mario\",\"surname\":\"Rossi\"}}"}' | ||
| ``` | ||
|
|
||
| When you check the DynamoDB table, you can see the entry with all the attributes parsed by API Gateway. |
There was a problem hiding this comment.
| When you check the DynamoDB table, you can see the entry with all the attributes parsed by API Gateway. | |
| Navigate to [AWS Console DynamoDB Tables](https://eu-central-1.console.aws.amazon.com/dynamodbv2/home?#tables) and check for a table with name `Audit-Table`. | |
| When you check the DynamoDB table, you can see the entry with all the attributes parsed by API Gateway. |
Add this command to have a fully bash based testing cycle. Users can switch to AWS Console at any times.
aws dynamodb scan --table-name Audit-Table|
|
||
| ## Testing | ||
|
|
||
| Once this stack is deployed in your AWS account, copy the SQS queue name value from the output. |
There was a problem hiding this comment.
You can update with a bash script getting the full queue url/arn. Pls add this to your testing manual
aws sqs list-queues --query 'QueueUrls[?contains(@, `EntryPointToEventbridgePipe`)]'| ```sh | ||
| aws sqs send-message \ | ||
| --queue-url "https://sqs.<region-id>.amazonaws.com/<account-id>/<queue-name>" \ | ||
| --message-body '{"Message": "{\"content\":\"Test message\",\"params\":{\"name\":\"Mario\",\"surname\":\"Rossi\"}}"}' | ||
| ``` |
There was a problem hiding this comment.
| ```sh | |
| aws sqs send-message \ | |
| --queue-url "https://sqs.<region-id>.amazonaws.com/<account-id>/<queue-name>" \ | |
| --message-body '{"Message": "{\"content\":\"Test message\",\"params\":{\"name\":\"Mario\",\"surname\":\"Rossi\"}}"}' | |
| ``` | |
| ```sh | |
| aws sqs send-message \ | |
| --queue-url "<REPLACE_WITH_OUTPUT_FROM_PREVIOUS_COMMAND>" \ | |
| --message-body '{"Message": "{\"content\":\"Test message\",\"params\":{\"name\":\"Mario\",\"surname\":\"Rossi\"}}"}' |
Issue #, if available:
Description of changes:
New serverless pattern that sends messages from SQS queue to DynamoDB table via API Gateway using EventBridge Pipes. Implemented with CDK using Python.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.