DynamoDB Table#
Use this module to create a dynamo table for the project.
dynamo.DynamoDB#
Class for the DynamoDB Table.
Terraform resources:
- DynamodbTable: The Dynamo Table.
- IamPolicy: A policy that allows all CRUD opperation on the table.
If isstream is set to true, it will enable DynamoStream and attach a websocket api on the stream.
Terraform resources for stream:
- IamPolicy: A policy to allow stream reading.
- DynamoWebsocket: The websocket api.
Arguments
Name | Type | Description |
---|---|---|
isstream | bool | Enable or not the dynamo stream |
tags | dict | Tags for all resource, must include a 'project' and 'env' key |
Attributes
Name | Type | Description |
---|---|---|
table_name | str | Name of the dynamo table |
crud_arn | str | ARN of the CRUD policy |
streaming.DynamoWebsocket#
Resources for websocket API associated to a dynamo table.
Terraform resources:
- DynamodbTable: The table for managing open connections.
- IamPolicy: Policy for managing connections.
- Apigatewayv2Api: The Websocket API.
- IamRole: Role for lambdas.
- LambdaFunction: Manager and Messager for the API.
- LambdaPermission: Allow execution from api.
- CloudwatchLogGroup: Logs for lambdas.
- Apigatewayv2Integration: API Integration.
- Apigatewayv2Route: connect and disconnect routes.
- Apigatewayv2Deployment: API deployement.
- Apigatewayv2Stage: API version.
- LambdaEventSourceMapping: Connect lambdas to stream.
Argument | Type | Description |
---|---|---|
stream_arn | str | The dynamo stream arn |
stream_policy_arn | str | The arn to allow readings of the stream |
tags | dict | Tags for all resource, must include a 'project' and 'env' key |
Example#
Create a dynamo table with no streams:
from src.dynamo import DynamoDB
tags = {
"project": "My Project",
"env": "dev"
}
dynamo = DynamoDB(self, "dynamo", isstream=False, tags=tags)