LoginSignup
8
3

More than 5 years have passed since last update.

AWS EC2でHyperledger Fabricを動かす(1.AWS準備編)

Last updated at Posted at 2018-01-07

AWSにUbuntuをセットアップし、FabricをDockerで起動してみたいと思います。
普段はVirtualBox内のUbuntuでFabricを動かしていて、AWSを触るのは初めて。
果たして最後までできるのかわかりませんが、とりあえず始めてみます。

今回はAWSでサーバを準備する手順をメモ。
大きく分けると以下の手順を実行します。

  1. EC2インスタンス作成〜起動
  2. SSH設定変更
  3. ターミナルからインスタンスへ接続する

1. EC2インスタンス作成〜起動

ログインしてコンソールを表示、仮想マシンの起動を選択します
Image 2018-01-05 18-06-33.jpg

EC2インスタンスを今すぐ始めます
Image 2018-01-05 18-01-53.jpg

適当な名前を入力してください
Image 2018-01-05 18-08-51.jpg

Ubuntu Server 16.04 LTSを選択して続行します
Image 2018-01-05 18-09-49.jpg

インスタンスタイプは無料枠のtc2.microのまま、続行します
Image 2018-01-07 16-31-54.jpg

キーペアに適当な名前を入力してファイルをダウンロードします
ダウンロードしたファイルは、~/.ssh ディレクトリに保管しましょう
Image 2018-01-05 18-12-55.jpg

インスタンスを作成します
Image 2018-01-05 18-13-42.jpg

作成には数分かかります
さきにEC2コンソールへ移動しましょう
Image 2018-01-05 18-14-20.jpg

ステータスがrunningになったら作成完了です
Image 2018-01-07 16-35-28.jpg

ここでSSHログイン試行するも、タイムアウトで接続できず。
軽く調べたところ、SSHの設定の変更が必要?とのこと。
次の手順でセキュリティグループの設定を変更します。

2. SSH設定変更

インスタンスを選択すると詳細が下の方に表示されます
この中から、セキュリティグループを選択します
Image 2018-01-07 16-33-49.jpg

SSHのインバウンドのソースが特定のネットワークに限定されているため解除します
編集を選択します
Image 2018-01-07 16-39-34.jpg

ソースを任意の場所に設定して保存します
Image 2018-01-07 15-56-24.jpg

3. ターミナルからインスタンスへ接続する

インスタンス作成時に保存したキーペアファイルが~/.sshディレクトリにコピーされている前提です。
権限を編集してからsshで繋ぎます。
AWSのUbuntuでは、ubuntuがデフォルトユーザになります。
アクセス先のIPアドレスは、インスタンスの「パブリックDNS(IPv4)」です。

$ chmod 400 .ssh/user1.pem 
$ ssh -i ".ssh/user1.pem" ubuntu@ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com
The authenticity of host 'ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com (xx-xx-xx-xx)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com,xx-xx-xx-xx' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-1043-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.



The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@ip-xx-xx-xx-xx:~$ pwd
/home/ubuntu

AWS EC2のUbuntu 16.04に、SSHでログインできました。

次は、Fabricを起動できればと思います。

8
3
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
8
3