diff --git a/infra/backend.ts b/infra/backend.ts index 2b06855..4d61045 100644 --- a/infra/backend.ts +++ b/infra/backend.ts @@ -45,6 +45,20 @@ new aws.cloudwatch.LogGroup(`${prefix}-lambda-log-group`, { }); +// ---- database ---- +new aws.dynamodb.Table(`${prefix}-db`, { + tags, + name: "objects", + attributes: [ + { name: "userId", type: "S", }, + { name: "sortKey", type: "S", }, + ], + hashKey: "userId", + rangeKey: "sortKey", + billingMode: "PAY_PER_REQUEST", +}); + + // ---- API Gateway ---- const api = new aws.apigatewayv2.Api(`${prefix}-api`, { tags, diff --git a/infra/database.ts b/infra/database.ts deleted file mode 100644 index 9bc8fa9..0000000 --- a/infra/database.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as aws from "@pulumi/aws"; -import * as pulumi from "@pulumi/pulumi"; - -import * as common from "./common"; - -const tags = common.tags; -const prefix = `${common.prefix}-database`; - -new aws.dynamodb.Table(`${prefix}-users`, { - tags, - name: "Users", // これがDynamoDBのTableNameになる - attributes: [ - { name: "id", type: "S", }, - ], - hashKey: "id", - billingMode: "PAY_PER_REQUEST", -}); diff --git a/infra/index.ts b/infra/index.ts index 05bb2ad..d57c324 100644 --- a/infra/index.ts +++ b/infra/index.ts @@ -4,7 +4,5 @@ import * as aws from "@pulumi/aws"; import * as backend from "./backend"; import * as frontend from "./frontend"; -import "./database"; - export const frontendDomain = frontend.cloudfront.domainName; export const backendEndpoint = backend.endpoint;