現在のプロジェクト状況を確認した結果、以下の構成を提案いたします:
output: 'export'
**でSSG(静的サイト生成)モード適用ケース: 現在のSSG設定を活かしたい場合
メリット:
設定方法:
# amplify.yml(プロジェクトルートに作成)
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: dist # next.config.mjsのdistDirと一致
files:
- '**/*'
cache:
paths:
- node_modules/**/*
適用ケース: より細かい制御が必要な場合
構成:
適用ケース: サーバーサイド機能が必要な場合
設定変更が必要:
// next.config.mjs
const nextConfig = {
output: 'standalone', // exportから変更
// distDir: 'dist', // コメントアウト
// trailingSlash: true, // コメントアウト
// images: { unoptimized: true }, // コメントアウト
}
構成:
適用ケース: イベント駆動型の機能が必要な場合
# 現在のビルドが正常に動作することを確認
npm run build
# amplify.yml
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
構成 | 月間コスト目安 | スケーラビリティ | 管理負荷 |
---|---|---|---|
Amplify Hosting | $1-10 | 自動 | 低 |
S3 + CloudFront | $1-5 | 自動 | 中 |
ECS Fargate | $10-50 | 手動 | 高 |
Lambda | $0.1-10 | 自動 | 低-中 |
現在のSSG設定を活かしてAWS Amplify Hostingから始めることをお勧めします。理由:
output: 'export'
がそのまま使えるもしサーバーサイド機能が必要になった場合は、後からECS FargateやLambdaに移行することも可能です。
どの構成について詳しく知りたいか、または実際の移行作業を始めたいかお聞かせください。