UEC: Manajemen Instance
Secara umum ada tiga (3) tipe tools yang dapat digunakan untuk me-manage instance Eucalyptus.
- Firefox Plugins – Elasticfox and Hybridfox
- Command Line tools like euca2ools
- Custom applications developed using EC2 APIs. ( Will not be covered in this beginner’s guide )
Elasticfox
Elasticfox is an open source Mozilla Firefox extension that works on Firefox Version 2.0 or later to help you with managing your Amazon EC2 account – Launch new instances, mount Elastic Block Storage volumes, map Elastic IP addresses, and more. This was originally written for EC2, but, since version xxx.xxx, it can also be used for managing your Eucalyptus account as well, because API of Eucalyptus is compatible with that of EC2. Features
* List available Machine images (AMIs in the case of AWS and EMIs in the case of Eucalyptus) * List running instances * Launch new instances of an AMI/EMI * Manage security groups and rules * Manage Snapshots/EBS volumes
Installation on Firefox
Install the extension from http://s3.amazonaws.com/ec2-downloads/elasticfox.xpi
You will need to restart Firefox before you can start using Elasticfox. You can launch Elasticfox from ‘Tools’ menu of Firefox. Configuration Define a Region
* Click on Regions button * Enter a logical name for the region (Example: “Eucalyptus” , “MyEucalyptus” etc.) * Enter the value of EC2_URL from your eucarc file as the Endpoint URL(http://192.168.10.121:8773/services/Eucalyptus in our sample setup)
Define Credentials
* Click on Credentials button * Enter a logical name for the credential set (Example: “EucaAcc1″ etc.) * Enter EC2_ACCESS_KEY and EC2_SECRET_KEY from your eucarc file as the AWS Access Key and AWS Secret Access Key respectively
Define Key Pairs
* Click on KeyPairs tab * Click on “Create a ney keypair” icon * Enter a name for the key pair (Example: “eucakey” etc.) * Choose location on the client machine to save the id file to (You will need this to use with putty etc. to make an SSH connection)
Define Security Groups
* Click on SecurityGroups tab * Enter a name for the group (Example: “Eucalyptus”, “EucaGroup” etc.) * Enter the description and click on create button * You will have an option to specify some basic ports like SSH/RDP to be opened up while creating the group itself. After the group is created, you can add rules any time by choosing the security group in the left pane titled “Your groups” and adding rules in the right pane titled “Group Permissions”
For more information, http://ec2-downloads.s3.amazonaws.com/elasticfox-owners-manual.pdf
Hybridfox
Hybridfox was forked from Elasticfox to make it usable with Eucalyptus, when Elasticfox worked only with AWS. Hybridfox can be used as the single interface to AWS and Eucalyptus.
The interface of Hybridfox is similar to Elasticfox and all the above steps in configuring Elasticfox apply to Hybridfox as well.
Even after the recent release of Elasticfox (version 1.7) with support for Eucalyptus, Hybridfox has the following additional features that make it attractive for users of Eucalyptus:
* Raising instances with Private IP * Some quirks related to hard coded mapping of instance types and architecture types addressed * Support for Eucalyptus 1.5.x as well as 1.6.x * Other usability enhancements
You can install the extension from http://code.google.com/p/hybridfox/downloads/list. The latest version (at the time of writing) is hybridfox-1.6.000024.xpi.
You will need to restart Firefox before you can start using Hybridfox. You can access Hybridfox from ‘Tools’ menu of Firefox.
Command Line Tool (Euca2ools)
Euca2ools dari Eucalyptus menyediakan beberapa command line tool untuk memanage eucalyptus. Perintah-perintah tersebut membantu kita dalam me-manage images, instances, storage, networking dll. Beberapa perintah yang akan berguna bagi kita akan di perlihatkan di bawah ini.
Instalasi euca2ools
$ sudo apt-get install euca2ools
Pembuatan Pasangan Kunci
Eucalyptus berharap client tool untuk menggunakan dua (2) macam credential. Satu set credential di sebut Access Key dan Secret Key yang digunakan oleh semua client yang membutuhkan untuk meminta sesuatu dari Cloud Controller. Setiap user yang terdaftar di interface web akan mempunyai set ini yang dibuatkan untuk masing-masing user. Kita dapat mengambilnya melalui Web seperti dijelaskan sebelumnya pada bagian “Web Interface”.
Kita juga perlu membuat sebuah pasangan kunci yang terdiri dari private key/public key untuk dapat menjalankan instance di Eucalyptus. Kunci ini di injeksi di instance dan dapat digunakan untuk melakukan akses passwordless SSH ke instance.
Pasangan kunci dapat di hasilkan menggunakan perintah berikut
uecadmin@client1:~$ cd ~/.euca uecadmin@client1:~/.euca$ source eucarc uecadmin@client1:~$ euca-add-keypair mykey > mykey.priv uecadmin@client1:~$ chmod 600 mykey.priv
Perintah di atas akan membuat pasangan key yang baru di sebut mykey. Private key mykey.priv akan di simpan secara lokal yang akan digunakan untuk menyambungkan ke instance yang di jalankan dengan mykey sebagai pasangan kunci.
Untuk melihat daftar pasangan kunci:
uecadmin@client1:~$ euca-describe-keypairs KEYPAIR mykey f7:ac:8e:f5:05:19:2b:31:28:8c:9b:d7:b8:07:0c:3c:b6:34:8f:79 KEYPAIR helloworld 12:96:b3:21:34:8d:6a:3f:92:2e:2b:70:23:ff:7f:51:b5:b7:ad:37 KEYPAIR ubuntu f6:af:9a:59:65:35:32:c4:3a:c4:62:0e:e1:44:0f:71:29:03:2d:91 KEYPAIR lucid 74:04:70:33:ed:57:7a:30:36:1f:ca:c6:ec:d5:4f:10:34:1a:52:51 KEYPAIR karmic 01:f9:aa:5f:4d:20:e2:53:d1:29:d0:0f:e2:f3:8c:21:91:70:7e:c8
Untuk men-delete pasangan kunci dapat menggunakan perintah
uecadmin@client1:~$ euca-delete-keypair helloworld
Tugas di atas dapat juga dilakukan menggunakan Hybridfox dari “Keypairs” tab.
Menjalankan dan Memanage Instance
Perintah berikut dapat digunakan untuk untuk menjalankan instance dengan menggunakan pasangan kunci yang kita buat, mencek status instance, dan meng-connect ke instance.
$ euca-run-instances emi-721D0EBA -k mykey -t c1.medium RESERVATION r-55560977 admin admin-default INSTANCE i-50630A2A emi-721D0EBA 0.0.0.0 0.0.0.0 pending mykey 2010-05-07T07:17:48.23Z eki-675412F5 eri-A1E113E0
$ euca-describe-instances RESERVATION r-55560977 admin default INSTANCE i-50630A2A emi-721D0EBA 192.168.10.200 172.19.1.2 running mykey 0 c1.medium 2010-05-07T07:17:48.23Z myueccluster eki-675412F5 eri-A1E113E0
01 $ euca-get-console-output i-50630A2A
02 i-50630A2A
03 2010-05-07T07:22:40.795Z
04 [ 0.000000] Initializing cgroup subsys cpuset
05 [ 0.000000] Initializing cgroup subsys cpu
06 [ 0.000000] Linux version 2.6.32-21-server (buildd@yellow) (gcc version 4.
07 4.3 (Ubuntu 4.4.3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 (Ub
08 untu 2.6.32-21.32-server 2.6.32.11+drm33.2)
09 [ 0.000000] Command line: root=/dev/sda1 console=ttyS0
10 [ 0.000000] KERNEL supported cpus:
11 [ 0.000000] Intel GenuineIntel
12 [ 0.000000] AMD AuthenticAMD
13 [ 0.000000] Centaur CentaurHauls
14 [ 0.000000] BIOS-provided physical RAM map:
15 [ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
16 [ 0.000000] BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
17 .............
18 .............
19 .............
uecadmin@client1:~$ ssh -i mykey.priv user@192.168.10.200
uecadmin@client1:~$ euca-reboot-instances i-50630A2A
uecadmin@client1:~$ euca-terminate-instances i-50630A2A
Make sure that you launch the instance with the correct VM type. If it is launched with a smaller VM type, then the following error is encountered.
error: insufficient disk capacity remaining
By default, m1.small is the VM type that is used which comes with a 2GB. So if you have a disk image of size 5GB, instead of
euca-run-instances emi-XXXXXXXX -k mykey
use
euca-run-instances emi-XXXXXXXX -k mykey -t c1.medium
VM type also has implications for amount of RAM and number of CPUs allocated to the instance. To know the configured VM types, please see the Configuration page of the web interface.
When you invoke “euca-run-instances” command (or when you choose to run an instance from Hybridfox/Elasticfox), here are a few things that happen on various components of UEC:
- Authentication/Authorization of the user request to ensure you have permission to launch the instance
- Identification of CC to take responsibility for deploying the instance and identification of the NC for running the instance.
- Downloading the image from WS3 to NC (images are cached so that starting multiple instances of the same machine image only downloads that image once)
- Create the requested virtual network interface
- Start the instance of the machine image running as a virtual machine using KVM
Starting and stopping of an instance is a complex process involving multiple components of UEC and a more detailed discussion is beyond the scope of a beginner’s guide.