Skip to main content

No project description provided

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 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk_pynamodb-0.1.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

cdk_pynamodb-0.1.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page