GithubHelp home page GithubHelp logo

pulumi-aws-dynamodb's Introduction

Pulumi AWS DynamoDB Component

This Pulumi Multi Language Component is a prototype Component exploring the idea to provide a different set of arguments to specified "difficulty" levels.

Default

The "defaul" difficulty provides a DynamoDB Table that is "PAY_PER_REQUEST" and has a Hash Key of "id".

import * as dynamo from "@pulumi/aws-dynamodb";

export const defaultTable = new dynamo.Table("default-table", {
    type: "default",
});

Basic

The "basic" difficulty provides a DynamoDB Table with a specified Hash and Range Keys.

import * as dynamo from "@pulumi/aws-dynamodb";

export const basicTable = new dynamo.Table("basic-table", {
    type: "basic",
    basic: {
        hashKey: {
            name: "id",
            type: "string",
        },
        rangeKey: {
            name: "score",
            type: "number",
        },
    },
});

Advanced

The "advance" difficulty provides a DynamoDB Table with a specified Hash and Range Keys as well as supports secondary indexes.

import * as dynamo from "@pulumi/aws-dynamodb";

export const advancedTable = new dynamo.Table("advanced-table", {
    type: "advanced",
    advanced: {
        attributes: [
            {
                name: "UserId",
                type: "S",
            },
            {
                name: "GameTitle",
                type: "S",
            },
            {
                name: "TopScore",
                type: "N",
            },
        ],
        globalSecondaryIndexes: [{
            hashKey: "GameTitle",
            name: "GameTitleIndex",
            nonKeyAttributes: ["UserId"],
            projectionType: "INCLUDE",
            rangeKey: "TopScore",
            readCapacity: 10,
            writeCapacity: 10,
        }],
        hashKey: "UserId",
        provisioned: {
            readCapacity: 10,
            writeCapacity: 10,
        },
        rangeKey: "GameTitle",
        tags: {
            Environment: "production",
            Name: "dynamodb-table-1",
        },
    },
});

Expert

The "expert" difficulty provides the full set of arguments to a DynamoDB Table resource.

import * as dynamo from "@pulumi/aws-dynamodb";

export const expertTable = new dynamo.Table("expert-table", {
    type: "expert",
    expert: {
        attributes: [{
            name: "TestTableHashKey",
            type: "S",
        }],
        billingMode: "PAY_PER_REQUEST",
        hashKey: "TestTableHashKey",
        replicas: [
            {
                regionName: "us-east-2",
            },
            {
                regionName: "us-west-1",
            },
        ],
        streamEnabled: true,
        streamViewType: "NEW_AND_OLD_IMAGES",
    },
});

Development

Prerequisites

  • Go 1.17
  • Pulumi CLI
  • Node.js (to build the Node.js SDK)
  • Yarn (to build the Node.js SDK)
  • Python 3.6+ (to build the Python SDK)
  • .NET Core SDK (to build the .NET SDK)

Build and Test

# Build and install the provider (plugin copied to $GOPATH/bin)
make install_provider

# Regenerate SDKs
make generate

# Test Node.js SDK
$ make install_nodejs_sdk
$ cd examples/simple
$ yarn install
$ yarn link @pulumi/aws-dynamodb
$ pulumi stack init test
$ pulumi config set aws:region us-east-1
$ pulumi up

pulumi-aws-dynamodb's People

Watchers

Zack Chase avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.