次はServlessコンテナです.AWS FargateとAWS増幅


AWS Fargateを使用してコンテナをサポートします.新しい機能を使用すると、Apache(REST&Graphql)を展開することができるだけでなく、Awust Fargateに直接Amplify CLIからホストしています.
このポストでは、次の展開方法をご案内します.Als Fargateには、AmplifyのCLIを使用してカスタムドメインとのJSアプリ.

For a complete walkthrough of this tutorial, check out . You can also view the Amplify container docs here


recently announced
始める

To follow this tutorial, you will first need to install and configure the Amplify CLI.


まず、新しい次を作成します.JSアプリ:
npx create-next-app nextonfargate
次に、新しい増幅プロジェクトを初期化します.
amplify init

? Enter a name for the project: nextonfargate
? Enter a name for the environment: dev
? Choose your default editor: <your-default-text-editor>
? Choose the type of app that youre building: javascript
? What javascript framework are you using: react
? Source Directory Path: .
? Distribution Directory Path: .next
? Build Command:  npm run-script build
? Start Command: npm run-script start

> When prompted, choose the AWS profile you'd like to use for this project.
次に、プロジェクトを配備してコンテナ展開を有効にします.
amplify configure project

? Enter a name for the project nextonfargate
? Choose your default editor: <your-default-text-editor>
? Choose the type of app that youre building javascript
? What javascript framework are you using react
? Source Directory Path:  .
? Distribution Directory Path: .next
? Build Command:  npm run-script build
? Start Command: npm run-script start
? Do you want to enable container-based deployments? Yes
? Do you want to update or remove the project level AWS profile? No

ドメインをRoute 53に追加する
次に、 を開き、左側のメニューのホストされているゾーンをクリックします.
「ホストを作成」をクリックし、使用するドメイン名を入力し、「作成したゾーン」をクリックします.
Route53 dashboard
Route 53では、ドメイン名のDNSを設定するために4つのネームサーバを指定する必要があります.

次に、ドメイン名登録サービスを訪れ、ドメイン名をこれらのネームサーバで設定します.


ホストゲートの追加
次に、次のコマンドを実行してFargateホスティングを追加します.
amplify add hosting

? Select the plugin module to execute: Container-based hosting with AWS Fargate
? Provide your web app endpoint: www.yourdomain.com
? Do you want to automatically protect your web app using Amazon Cognito Hosted UI: No
プロジェクトをローカルに設定する必要があり、プロジェクトのルートで作成されたDockerFileが表示されます.
DockerFileを次のように更新し、ファイルを保存します.
< div >
< H >

展開
<高橋潤子>
<堀田>そのためには以下のコマンドを実行することができます.
<> P >
クラスをハイライト表示する
amplify publish
< div >
展開が成功すると、ライブドメインでアプリケーションを表示できるはずです.p >
< H 3 >

デバッグ
<高橋潤子>
<川合>p >
< H 3 >

更新の配備
<高橋潤子>
一度変更して配備する準備ができたら、いつでもamplify publishを実行してアップデートを展開することができます.p >
< H >
CodeBuild
ビデオ
<高橋潤子>
このビデオの完全なチュートリアルのためにこのビデオをチェックアウトしますp >
<高橋>https://www.youtube.com/embed/rA5l82vypXc"allowfulscreen = ""読み込み= "lazy "
< iframe >
<> P >