

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# バイナリメソッドを使用してオンプレミスの Go ウェブアプリケーションを AWS Elastic Beanstalk に移行します
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method"></a>

*Amazon Web Services、Suhas Basavaraj、Shumaz Mukhtar Kazi*

## 概要
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-summary"></a>

このパターンでは、オンプレミスの Go ウェブアプリケーションを AWS Elastic Beanstalk に移行する方法について説明します。アプリケーションの移行後、Elastic Beanstalk はソースバンドルのバイナリを構築し、Amazon Elastic Compute Cloud (Amazon EC2) インスタンスにデプロイします。

リホスト移行戦略としては、このパターンのアプローチは高速で、コードを変更する必要がないため、テストや移行にかかる時間を短縮できます。 

## 前提条件と制限事項
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-prereqs"></a>

**前提条件**
+ アクティブな AWS アカウント。
+ オンプレミスから Web アプリケーションへ
+ ソースコードを含む または GitHub リポジトリ。GitHub を使用しない場合は、[Elastic Beanstalk のアプリケーションソースバンドルを作成する他の方法があります](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.html)。

**製品バージョン**
+ Elastic Beanstalk でサポートされている最新の Go バージョンです。Elastic Beanstalk の詳細については、[Elastic Beanstalk のドキュメント](https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.go)を参照してください。

## アーキテクチャ
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-architecture"></a>

**ソーステクノロジースタック**
+ オンプレミスから Web アプリケーションへ 

**ターゲットテクノロジースタック**
+ AWS Elastic Beanstalk
+ Amazon CloudWatch

**ターゲット アーキテクチャ*** *

![\[Elastic Beanstalk に Go アプリケーションを移行するためのアーキテクチャ\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/images/pattern-img/cd8d660d-5621-4ea7-8f97-7a1e321c57d3/images/1df543d9-7073-43d8-abd3-f1f7e57278eb.png)


## ツール
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-tools"></a>
+ [AWS Elastic Beanstalk](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.html) を使用すると、アプリケーションを実行しているインフラストラクチャについて知識を得なくても、AWS クラウドでアプリケーションのデプロイと管理を簡単に行うことができます。Elastic Beanstalk は、選択肢を狭めたり制御を制限したりすることなく、管理の複雑さを軽減します。
+ [GitHub](https://github.com/) はオープンソースの分散型バージョン管理システムです。

## エピック
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-epics"></a>

### Go Web アプリケーションソースバンドル (.zip ファイル) を作成します。
<a name="create-the-go-web-application-source-bundle-zip-file"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| Go Web アプリケーションソースバンドル (.zip ファイル) を作成します。 | Go アプリケーションのソースコードを含む GitHub リポジトリを開き、ソースバンドルを準備します。ソースバンドルには、Go `application.go` アプリケーションのメインパッケージをホストするルートディレクトリにソースファイルが含まれています。GitHub を使用しない場合は、アプリケーションソースバンドルを作成する他の方法について、このパターンの前半の*前提条件* セクションを参照してください。 | システム管理者、アプリケーション開発者 | 
| 設定ファイルを作成します。 | ソースバンドルに `.ebextensions` フォルダを作成し、そのフォルダ内に `options.config` ファイルを作成します。Elastic Beanstalk の詳細については、[Elastic Beanstalk のドキュメント](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html)を参照してください。 | システム管理者、アプリケーション開発者 | 
|  ソースバンドルの.zip ファイルを作成します。 | 以下のコマンドを実行してください。<pre>git archive -o ../godemoapp.zip HEAD</pre>ソースバンドルの.zip ファイルを作成します。.zip ファイルをローカルファイルとしてダウンロードして保存します。.zip ファイルは 512 MB を超えることはできません。また、親フォルダまたは最上位ディレクトリを含めることはできません。 | システム管理者、アプリケーション開発者 | 

### Elastic Beanstalk に Go ウェブアプリケーションを移行する
<a name="migrate-the-go-web-application-to-elastic-beanstalk"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| Elastic Beanstalk アプリケーションを選択します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method.html)Elastic Beanstalk アプリケーションを作成する方法については、[Elastic Beanstalk のドキュメント](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.CreateApp.html) を参照してください。 | システム管理者、アプリケーション開発者 | 
| Elastic Beanstalk ウェブサーバー環境を開始します。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method.html) | システム管理者、アプリケーション開発者 | 
| ソースバンドルの.zip ファイルを Elastic Beanstalk にアップロードします | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method.html) | システム管理者、アプリケーション開発者 | 
| デプロイした Go Web アプリケーションをテストします。 | Elastic Beanstalk アプリケーションの概要ページにリダイレクトされます。概要の上部にある**環境 ID** の横で、`elasticbeanstalk.com` アプリケーションに移動するための末尾の URL を選択します。アプリケーションでは、設定ファイル内でこの名前を環境変数として使用し、Web ページに表示する必要があります。 | システム管理者、アプリケーション開発者 | 

## トラブルシューティング
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-troubleshooting"></a>


| 問題 | ソリューション | 
| --- | --- | 
| Application Load Balancer を介してアプリケーションにアクセスできない | Elastic Beanstalk アプリケーションを含むターゲットグループを確認します。異常がある場合は、Elastic Beanstalk インスタンスにログインし、`nginx.conf` ファイル設定をチェックして、正しいヘルスステータス URL にルーティングされていることを確認します。ターゲットグループのヘルスチェック URL を変更する必要がある場合があります。 | 

## 関連リソース
<a name="migrate-an-on-premises-go-web-application-to-aws-elastic-beanstalk-by-using-the-binary-method-resources"></a>
+ 古い Elastic Beanstalk プラットフォームバージョンは IMDSv1 をサポートしていました。
+ [Elastic Beanstalk での設定ファイルの使用](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html)
+ [Elastic Beanstalk でのサンプルアプリケーションの作成](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.CreateApp.html) 