AWS CDK DynamoDB table construct from PynamoDB models.
Project description
AWS CDK Construct for DynamoDB Table from PynamoDB Model.
Streamline DynamoDB create and deploy with PynamoDB and AWS CDK.
This package provides a construct for creating a DynamoDB table using the AWS CDK and PynamoDB models. It simplifies the process of creating and deploying DynamoDB tables in your AWS environment.
Define your tables in a reusable and predictable way with infrastructure-as-code.
Installation
From PyPi:
$ pip install cdk-pynamodb
From GitHub:
$ pip install git+https://github.com/altoria/cdk-pynamoDB#egg=cdk-pynamodb
Basic Usage
Create a model that describes your DynamoDB table.
from pynamodb.models import Model
class UserTable(Model):
class Meta:
host = "http://localhost:8000"
table_name = "user-table"
billing_mode = PROVISIONED_BILLING_MODE
read_capacity_units = 10
write_capacity_units = 3
user_id = UnicodeAttribute(hash_key=True)
email = UnicodeAttribute(null=True)
Now, you can import and construct model in AWS CDK
from cdk_pynamodb import PynamoDBTable
from models import UserTable
from aws_cdk import Stack
from constructs import Construct
class Database(Stack):
def __init__(self, scope: Construct, id_: str):
super().__init__(scope, id_)
self.table = PynamoDBTable.from_pynamodb_model(self, pynamodb_model=UserTable)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cdk_pynamodb-0.1.1.tar.gz
.
File metadata
- Download URL: cdk_pynamodb-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/22.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a56624958a76746bf8e697fd0484505b525256eefe64844da5f73e541b11766 |
|
MD5 | 610f7da3f26cfefe92ae7623af999ff9 |
|
BLAKE2b-256 | f0e91e6094d9905a94c33fd481cddf85ec657f97d6a258c5625305277d115270 |
File details
Details for the file cdk_pynamodb-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: cdk_pynamodb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/22.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a488686dcdca56c03c67522a8a2ead77deee81c310e3da0755d0b77eab6d7990 |
|
MD5 | 40e8e7cead5f81531a43906508672350 |
|
BLAKE2b-256 | 9910188b718b64f07822d6acee11e25e61076473589143e93eb306b219413d49 |