improve database schema

This commit is contained in:
falsycat 2025-06-19 22:29:18 +09:00
parent 215c0d72fd
commit 890087a572
3 changed files with 14 additions and 19 deletions

View File

@ -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 ---- // ---- API Gateway ----
const api = new aws.apigatewayv2.Api(`${prefix}-api`, { const api = new aws.apigatewayv2.Api(`${prefix}-api`, {
tags, tags,

View File

@ -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",
});

View File

@ -4,7 +4,5 @@ import * as aws from "@pulumi/aws";
import * as backend from "./backend"; import * as backend from "./backend";
import * as frontend from "./frontend"; import * as frontend from "./frontend";
import "./database";
export const frontendDomain = frontend.cloudfront.domainName; export const frontendDomain = frontend.cloudfront.domainName;
export const backendEndpoint = backend.endpoint; export const backendEndpoint = backend.endpoint;