コンピュータを楽しもう!!

今、自分が面白くていろいろやってみたことを書き綴りたいと思います。連絡先はtarosa.yでgmail.comです。

WindowsでVagrant ec2を試してみる(7) vagrant up --provider=aws

いよいよ、vagrant upして、awsのEC2インスタンスVagrantを用いて生成してみます。
起動は、--providerオプションをつけます。
GitBashを起動します。GitBashについては、WindowsでVagrant ec2を試してみる(1) 事前環境作りで説明しています。

vagrant up --provider=aws実行

実行するには、先ず、Vagrantを起動するフォルダを作成します。今回は ~/Documents/Vagrant/aws フォルダでVagrantを起動したいと思います。先ず、~/Documents/Vagrant/awsフォルダに先ほどのVagrantfileを置きます。そして、~/Documents/Vagrant/awsフォルダに移動します。
そして、vagrant up --provider=aws を 実行します。

$ cd ~/Documents/Vagrant/aws
$ vagrant up --provider=aws
Bringing machine 'default' up with 'aws' provider...
[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.
==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
==> default: This is a bug with the provider. Please contact the creator
==> default: of the provider you use to fix this.
==> default: Warning! The AWS provider doesn't support any of the Vagrant
==> default: high-level network configurations (`config.vm.network`). They
==> default: will be silently ignored.
==> default: Launching an instance with the following settings...
==> default:  -- Type: t1.micro
==> default:  -- AMI: ami-bddaa2bc
==> default:  -- Region: ap-northeast-1
==> default:  -- Availability Zone: ap-northeast-1c
==> default:  -- Keypair: VagrantEC2
==> default:  -- Security Groups: ["VagrantEC2SecurityGroup"]
==> default:  -- Block Device Mapping: []
==> default:  -- Terminate On Shutdown: false
==> default:  -- Monitoring: false
==> default:  -- EBS optimized: false
==> default: Waiting for instance to become "ready"...
==> default: Waiting for SSH to become available...
==> default: Machine is booted and ready for use!
==> default: Warning! Folder sync disabled because the rsync binary is missing in the host.
==> default: Make sure rsync is installed and the binary can be found in the PATH.

これでインスタンスが生成されているはずです。vagrant sshしてみます。

$ vagrant ssh
[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sat Jun 21 19:26:23 UTC 2014

  System load:  0.81             Processes:           73
  Usage of /:   9.6% of 7.75GB   Users logged in:     0
  Memory usage: 11%              IP address for eth0: 172.31.23.210
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  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.


ubuntu@ip-172-31-23-210:~$

無事、ログインできました。
awsのEC2を見てみると、インスタンスが生成されていることが確認できます。

TeraTermからログインしてみる

ここまで来ると、使い慣れたTeraTermからログインしたくなります。ということで、ログインしてみます。TeraTermのインストール方法は、TeraTermの最新版(4.82)をWindows7にインストールしてみました!サイトなどを参考にしてください。
TeraTermを起動します。EC2のIPアドレスは、awsのEC2インスタンスのConnectポタンを押して確認します。WindowsでVagrant ec2を試してみる(6) Vagrantfilesの作成のoverride.ssh.usernameのところで少し解説しています。

OKを押すと、セキュリティ警告がでるので、「続行」を押します。

User名に ubuntuを入れて、パスフレーズは無しでいいです。RSA/DSA鍵を使うを選択し VagrantEC2.pemファイルを選びます。

OKを押すと、TeraTermでEC2にログインできました。


以上でWindowsからVagrantaws EC2のインスタンスを生成する解説を終わります。