Skip to content

Instantly share code, notes, and snippets.

@louislatreille
Created April 10, 2022 22:40
Show Gist options
  • Save louislatreille/c7cc35cc4f48ae4e9475d5bd3cd202f0 to your computer and use it in GitHub Desktop.
Save louislatreille/c7cc35cc4f48ae4e9475d5bd3cd202f0 to your computer and use it in GitHub Desktop.
Serverless Streamlined - dynamodbMainTable.ts
import { varToString } from "./utilities";
export const createMainTable = () => {
const mainTable = {
Type: "AWS::DynamoDB::Table",
Properties: {
AttributeDefinitions: [
{
AttributeName: "PK",
AttributeType: "S",
},
{
AttributeName: "SK",
AttributeType: "S",
},
],
BillingMode: "PAY_PER_REQUEST",
KeySchema: [
{
AttributeName: "PK",
KeyType: "HASH",
},
{
AttributeName: "SK",
KeyType: "RANGE",
},
],
},
};
return {
resources: { mainTable },
name: { Ref: varToString({ mainTable }) },
arn: { "Fn::GetAtt": [varToString({ mainTable }), "Arn"] },
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment