LoginSignup
9
7

More than 1 year has passed since last update.

個人開発で愛用しているNext.jsデプロイ手順 (~5分)

Posted at

概要

個人開発をしようと思ったら、僕が最初にやることはNext.jsをAWSにホストすることです。
その際の手順を記載します。5分程度でインターネット公開することができます。

手順

① Create Next App

npx create-next-app@latest --ts <アプリ名>

serverless.ymlファイルの作成

cd <アプリ名>
touch serverless.yml
open serverless.yml

serverless.ymlに以下の内容を記載します。

myNextApplication:
  component: "@sls-next/serverless-component"

serverlessインストール

npm install -D serveless

デプロイ

以下コマンドを実行してデプロイ (AWS CLIの設定ができていることが前提です)

serveless

まとめ

以上の作業だけで、Next.jsをS3 + CloudFront構成でデプロイができます。
作業時間は5分程度でできるので自分はいつも最初にこれをやっています。

9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7