How to use the @pulumi/aws.dynamodb function in @pulumi/aws

To help you get started, we’ve selected a few @pulumi/aws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / examples / aws-ts-appsync / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as aws from "@pulumi/aws";
import * as random from "@pulumi/random";
import { createIamRole } from "./iam";

// Dynamo DB table to hold data for the GraphQL endpoint
const table = new aws.dynamodb.Table("tenants", {
    hashKey: "id",
    attributes: [{ name: "id", type: "S" }],
    readCapacity: 1,
    writeCapacity: 1,
});

// Create IAM role and policy wiring
const role = createIamRole("iam", table);

// GraphQL Schema
const schema =
    `type Query {
        getTenantById(id: ID!): Tenant
    }

    type Mutation {
github pulumi / examples / aws-ts-resources / index.ts View on Github external
logGroupName: logGroup.name,
});

const metricAlarm = new aws.cloudwatch.MetricAlarm("mymetricalarm", {
    comparisonOperator: "GreaterThanOrEqualToThreshold",
    evaluationPeriods: 2,
    metricName: "CPUUtilization",
    namespace: "AWS/EC2",
    period: 120,
    statistic: "Average",
    threshold: 80,
    alarmDescription: "This metric monitors ec2 cpu utilization",
});

// DynamoDB
const db = new aws.dynamodb.Table("mytable", {
    attributes: [
        { name: "Id", type: "S" },
    ],
    hashKey: "Id",
    readCapacity: 1,
    writeCapacity: 1,
});

// EC2
const eip = new aws.ec2.Eip("myeip");

const securityGroup = new aws.ec2.SecurityGroup("mysecuritygroup", {
    ingress: [
        { protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] },
    ],
});
github pulumi / examples / aws-ts-apigateway / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

// Create a mapping from 'route' to a count
const counterTable = new aws.dynamodb.Table("counterTable", {
    attributes: [{
        name: "id",
        type: "S",
    }],
    hashKey: "id",
    readCapacity: 5,
    writeCapacity: 5,
});

// Create an API endpoint
const endpoint = new awsx.apigateway.API("hello-world", {
    routes: [{
        path: "/{route+}",
        method: "GET",
        eventHandler: async (event) => {
            const route = event.pathParameters!["route"];
github pulumi / examples / aws-ts-serverless-raw / index.ts View on Github external
import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";

// The location of the built dotnet2.1 application to deploy
const dotNetApplicationPublishFolder = "./app/bin/Debug/netcoreapp2.1/publish";
const dotNetApplicationEntryPoint = "app::app.Functions::GetAsync";
// The stage name to use for the API Gateway URL
const stageName = "api";

///////////////////
// DynamoDB Table
///////////////////

// A DynamoDB table with a single primary key
const counterTable = new aws.dynamodb.Table("counterTable", {
    attributes: [
        { name: "Id", type: "S" },
    ],
    hashKey: "Id",
    readCapacity: 1,
    writeCapacity: 1,
});

///////////////////
// Lambda Function
///////////////////

// Give our Lambda access to the Dynamo DB table, CloudWatch Logs and Metrics.
const role = new aws.iam.Role("mylambda-role", {
    assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({ Service: "lambda.amazonaws.com" }),
});
github pulumi / pulumi-aws / examples / serverless / index.ts View on Github external
// Copyright 2016-2017, Pulumi Corporation.  All rights reserved.

import * as aws from "@pulumi/aws";

let music = new aws.dynamodb.Table("music", {
  attributes: [
    { name: "Album", type: "S" },
    { name: "Artist", type: "S" },
    { name: "NumberOfSongs", type: "N" },
    { name: "Sales", type: "N" },
  ],
  hashKey: "Album",
  rangeKey: "Artist",
  readCapacity: 1,
  writeCapacity: 1,
  globalSecondaryIndexes: [
    {
      name: "myGSI",
      hashKey: "Sales",
      rangeKey: "Artist",
      readCapacity: 1,
github pulumi / pulumi-aws / examples / metrics / index.ts View on Github external
tags: {
        Environment: "production",
    },
});

const queueMetric = queue.metrics.sentMessageSize();
const queueAlarm = queueMetric.createAlarm("alarm" + alarmIndex++, { threshold: 120, evaluationPeriods: 2 });

const restApi = new aws.apigateway.RestApi("MyDemoAPI", {
    description: "This is my API for demonstration purposes",
  });

const restApiMetric = restApi.metrics.error5XX();
const restApiAlarm = restApiMetric.createAlarm("alarm" + alarmIndex++, { threshold: 50, evaluationPeriods: 2 });

const table = new aws.dynamodb.Table("testtable", {
    attributes: [{
        name: "id",
        type: "S",
    }],
    hashKey: "id",
    readCapacity: 5,
    writeCapacity: 5,
    streamEnabled: true,
    streamViewType: "NEW_AND_OLD_IMAGES",
});

const tableMetric = table.metrics.throttledRequests();
const tableAlarm = tableMetric.createAlarm("alarm" + alarmIndex++, { threshold: 120, evaluationPeriods: 2 });

const bucket = new aws.s3.Bucket("b", {
    acl: "private",
github pulumi / pulumi-cloud / aws / table.ts View on Github external
() => {
                const table = new aws.dynamodb.Table(name, {
                    attribute: [
                        {
                            name: primaryKey,
                            type: pulumiKeyTypeToDynamoKeyType(primaryKeyType!),
                        },
                    ],
                    hashKey: primaryKey,
                    readCapacity: 5,
                    writeCapacity: 5,
                });
                tableName = table.name;
            },
        );
github communitybridge / easycla / infra / index.ts View on Github external
function buildProjectsTable(importResources: boolean): aws.dynamodb.Table {
  return new aws.dynamodb.Table(
    'cla-' + stage + '-projects',
    {
      name: 'cla-' + stage + '-projects',
      attributes: [
        { name: 'project_id', type: 'S' },
        { name: 'project_external_id', type: 'S' },
        { name: 'project_name', type: 'S' },
        { name: 'project_name_lower', type: 'S' },
        { name: 'foundation_sfid', type: 'S' },
      ],
      hashKey: 'project_id',
      billingMode: 'PAY_PER_REQUEST',
      streamEnabled: true,
      streamViewType: "NEW_AND_OLD_IMAGES",
      globalSecondaryIndexes: [
        {
github pulumi / pulumi-awsx / nodejs / examples / metrics / index.ts View on Github external
tags: {
        Environment: "production",
    },
});

const queueMetric = awsx.sqs.metrics.sentMessageSize({ queue });
const queueAlarm = queueMetric.createAlarm("alarm" + alarmIndex++, { threshold: 120, evaluationPeriods: 2 });

const restApi = new aws.apigateway.RestApi("MyDemoAPI", {
    description: "This is my API for demonstration purposes",
  });

const restApiMetric = awsx.apigateway.metrics.error5XX({ restApi });
const restApiAlarm = restApiMetric.createAlarm("alarm" + alarmIndex++, { threshold: 50, evaluationPeriods: 2 });

const table = new aws.dynamodb.Table("testtable", {
    attributes: [{
        name: "id",
        type: "S",
    }],
    hashKey: "id",
    readCapacity: 5,
    writeCapacity: 5,
    streamEnabled: true,
    streamViewType: "NEW_AND_OLD_IMAGES",
});

const tableMetric = awsx.dynamodb.metrics.throttledRequests({ table });
const tableAlarm = tableMetric.createAlarm("alarm" + alarmIndex++, { threshold: 120, evaluationPeriods: 2 });

const bucket = new aws.s3.Bucket("b", {
    acl: "private",
github communitybridge / easycla / infra / index.ts View on Github external
function buildGitHubOrgsTable(importResources: boolean): aws.dynamodb.Table {
  return new aws.dynamodb.Table(
    'cla-' + stage + '-github-orgs',
    {
      name: 'cla-' + stage + '-github-orgs',
      attributes: [
        { name: 'organization_name', type: 'S' },
        { name: 'organization_sfid', type: 'S' },
        { name: 'project_sfid', type: 'S' },
      ],
      hashKey: 'organization_name',
      billingMode: 'PROVISIONED',
      streamEnabled: true,
      streamViewType: "NEW_AND_OLD_IMAGES",
      readCapacity: defaultReadCapacity,
      writeCapacity: defaultWriteCapacity,
      globalSecondaryIndexes: [
        {