あなたのノードJSアプリをAWSエラスティック
7937 ワード
今日、我々は簡単なAPIをAWSの弾力性ビーン茎サービスに配備する方法を学びます.
前提条件
AWSに登録するGuide here
インストールdownload
EB CLIインストールInstallation Guide here
eb cliとgit cliがマシンにインストールされているかどうかを調べます.
セットアップ
クリックhere シンプルエクスプレススターター
インストール
スタートスクリプトを書きましょう
クリエイトア
Gitセットアッププロジェクト 国際通貨基金 Git add 最初のコミット"
AWSインスタンスを初期化する方法を見てみましょう.
EB INITフラグを実行する
上記のコマンドは
拡張モジュール
電子メールの初期化後、フォルダを作成
フラグを実行します. 注意:使用を避ける
EBアプリを開くには
EBログ
EBヘルプ
注意:角括弧を含まない
EB initプロジェクトを削除するには
結論
このガイドが役に立つことを願っています.読書ありがとう
資源
Deploy Express app on aws
前提条件
AWSに登録するGuide here
インストールdownload
EB CLIインストールInstallation Guide here
eb cliとgit cliがマシンにインストールされているかどうかを調べます.
セットアップ
npm init -y
あなたのアプリケーションを初期化する.クリックhere シンプルエクスプレススターター
hello world
アプリ.インストール
express
このコードをパッケージに入れてダンプしますindex.js
ファイル
const express = require('express')
const app = express()
const port = process.env.PORT|| 3000;
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
スタートスクリプトを書きましょう
package.json
クリエイトア
.gitignore
ファイルを追加しますnode_modules/
.gitignore
.elasticbeanstalk/
Gitセットアッププロジェクト
弾性beanstalk AWSインスタンスの展開
AWSインスタンスを初期化する方法を見てみましょう.
EB INITフラグを実行する
eb init --platform node.js --region us-east-2
上記のコマンドは
.elasticbeanstalk folder
拡張モジュール
電子メールの初期化後、フォルダを作成
.ebextensions
とファイルnodecommands.config
我々のスタートコマンドをnodecommands.config
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"
アプリケーション環境を作成する
eb create [environment-name]
The is the name of your application, in this example I usedelasticbean
hence the command is [eb create elasticbean]
_
プロジェクトフォルダの名前アプリケーションの配備
EBアプリを開くには
コマンド
EBログ
EBヘルプ
注意:角括弧を含まない
EB initプロジェクトを削除するには
Go to the directory of your project (the directory where you originally ran the "eb init" command). Delete the . elasticbeanstalk directory. You can now run "eb init" again, and it will prompt you for your configuration information.
結論
このガイドが役に立つことを願っています.読書ありがとう
資源
Deploy Express app on aws
Reference
この問題について(あなたのノードJSアプリをAWSエラスティック), 我々は、より多くの情報をここで見つけました https://dev.to/drsimplegraffiti/deploy-your-node-js-app-on-aws-elastic-beanstalk-50jjテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol