Part 1. Create AWS EC2 instances. One inside US; One outside US.
- Besides configuring the IIS follwing the instruction in part1, the fastest way to set up a windows 2008R2 IIS web site is to an instance already configured with IIS.
- select
- specify a keypair name and download the private key.
- After the instance started, right click on the instance and select "get windows password". Copy and past the private key into the decrypt pasword dialog box to get the password for the Administrator.
- Once login, you can install the SSH software for downloading the bmsite software to c:\inetpub/wwwroot/
- Now the web site is ready for access.
Benchmark the performance of two IIS servers you just set up.
- Here are the benchmarking results with a windows 2008 R2 IIS instance in each region.
Note that there is almost no difference between using the Small (1.7GB) and the Micro (613MB) in this test.
- Q1.1. Compare the performance of the two IIS servers. Discuss the reason for such results.
Ans:
Everything being equal, the web serve performances are decided by the connection charateristics between gandalf and those web server. The order of these web servers ranked from the fastest to the slowest is:
US East, US West (California), US West (Oregon), EU West(Ireland), AP Northest(Tokyo), South America(Sao Paulo), and AP Southeast(Singapore).
- Q1.2. There are four Availability Zones in N. Virginia site. If you have four servers, would you spread them in each of the four zones or set up them all in the same zone? What are the design trade-off?
Ans:
It depends on the system design requirements. If the availability is more important than the performance and these four servers provides similar services to the users, then we will spread them on those four zone. If the tasks require a lot of interactions among these four servers and the availability is not as important as the performance, then we would like the four server to be located in the same zone and take advantages of faster network connections within the data center, and avoid additional network congestion and delay between data centers, even though they are in the same region.
- Q1.3. If have customers in the Saudi Arabia, which region of the Amazon data center will you choose to setup the web server? What information will you collect for making such a decison? How you obtain it?
Ans:
It depends on which region has a bigger available bandwidth to Saudi. The following table shows the Ping and AB test results from a Saudi site. Ireland region seems to be closest followed by California region. It is best to launch the benchmark from a customer site at Saudi, or request the traffic info/statistics from AWS.
Part 2. Use Amazon EC2 API Tools to control instances.
- Linux login session:
Ans:
[root@gandalf aws]# ssh -i cs526LinuxKey.pem ec2-23-20-98-175.compute-1.amazonaws.com
The authenticity of host 'ec2-23-20-98-175.compute-1.amazonaws.com (23.20.98.175)' can't be established.
RSA key fingerprint is 9c:99:90:49:84:a4:97:a1:f7:45:49:f7:91:d4:98:59.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-23-20-98-175.compute-1.amazonaws.com,23.20.98.175' (RSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'cs526LinuxKey.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: cs526LinuxKey.pem
Permission denied (publickey).
[root@gandalf aws]# chmod 700 cs526LinuxKey.pem
[root@gandalf aws]# ssh -i cs526LinuxKey.pem ec2-23-20-98-175.compute-1.amazonaws.com
Please login as the ec2-user user rather than root user.
Connection to ec2-23-20-98-175.compute-1.amazonaws.com closed.
[root@gandalf aws]# ssh -i cs526LinuxKey.pem ec2-users@ec2-23-20-98-175.compute-1.amazonaws.com
Permission denied (publickey).
[root@gandalf aws]# ssh -i cs526LinuxKey.pem ec2-user@ec2-23-20-98-175.compute-
1.amazonaws.com
__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|
See /usr/share/doc/system-release/ for latest release notes.
There are 2 security update(s) out of 19 total update(s) available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-212-170-142 ~]$ uname -a
Linux ip-10-212-170-142 3.2.12-3.2.4.amzn1.x86_64 #1 SMP Thu Mar 22 08:00:08 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[ec2-user@ip-10-212-170-142 ~]$ cd .ssh
[ec2-user@ip-10-212-170-142 .ssh]$ ls
authorized_keys
[ec2-user@ip-10-212-170-142 .ssh]$ cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCCo/XTv2Mri5/f3zHWMGDMMM8JCnjwzsZmpAQUbeetuT+qbsb8bjKdHcqyeVbPdIiaICKQuD
3btgsVxKvWIvC6BkzpFrq8Go2Fsm/r/d+1d7ou3nCvsRQ7nb6Wl..........IXtQwhKByv9LZ9w/6PTGCB7fMZCex8GdBhO60GzMM5zSTonGn
qPz6v0AFEpFjM16nNn34Su0PGppZusMrtSJ/KdbW6AJyPd794aUXUXIULKU8sBVspDtLp5nAg2z3ru8Iy5abScp51Nb5n2cfEBXk6XygEm65pj
MTobF cs526LinuxKey
- Q2. One of the most attractive features of EC2 is able to start the instance on demand. Assume that we know our students will only work on their server related exercises during evening hours (most of them have daytime work:-)), therefore we would like to run the Amazon Linux AMI instance only from 7-11pm.
- Q2.1. Describe your design of a system with the script that will automatically schedule the instance to run every night from 4/19 to 4/30.
Ans:
On Linux system, you can set up crontab file to inform crondaemon to run commands/scripts at certain time. See http://linux.die.net/man/5/crontab
Here is the aws.cron file for such setup:
0 19 19-30 4 * /home/cs526/aws/start.sh >> /home/cs526/aws/log 2>&1
0 23 19-30 4 * /home/cs526/aws/stop.sh >> /home/cs526/aws/log 2>&1
Run the command "crontab aws.cron" to set it up and type "crontab -l " to show the current list of cron jobs.
Run "crontab -r" to remove existing cron jobs.
The log will be added the following entry when stopping an instance
INSTANCE i-7c842f13 running stopping
The log will be added the following entry when starting an instance
INSTANCE i-7c842f13 stopped pending
- Q2.2. Assume you use ec2 command line api and have reserved an elasic IP address 50.17.160.64 for this instance. What will be the two start/stop ec2-api command looks like?
Ans:
Ans:
The start.sh contains the following content:
export EC2_PRIVATE_KEY=/home/cs526/aws/pk-4NR4SZ....VDOFIDMY6L5QLUP.pem
export EC2_CERT=/home/cs526/aws/cert-4NR4SZJ....FIDMY6L5QLUP.pem
ec2-start-instances i-7c842f13
ec2assocaddr -i i-7c842f13 50.17.160.64
The stop.sh contains the following content:
ec2-stop-instances i-7c842f13 -K /home/cs526/aws/pk-4NR4SZJMI.....DMY6L5QLUP.pem
-C /home/cs526/aws/cert-4NR4SZJMIQM.......FIDMY6L5QLUP.pem
or
export EC2_PRIVATE_KEY=/home/cs526/aws/pk-4NR4SZJM.....FIDMY6L5QLUP.pem
export EC2_CERT=/home/cs526/aws/cert-4NR4SZJMIQ.....FIDMY6L5QLUP.pem
ec2-stop-instances i-7c842f13
- Q2.3. Elastic IP address remap and idle will be charged with the following expense. What will be the total estimated cost for using aws to provide services in the above period? Please include EBS volume charge, Elastic IP address charge, and on-demand instance charge.
No cost for Elastic IP addresses while in use
- $0.01 per non-attached Elastic IP address per complete hour
- $0.00 per Elastic IP address remap – first 100 remaps / month
- $0.10 per Elastic IP address remap – additional remap / month over 100
Ans:
The total number of days to provide services is
12 days in April.
There will be 4 active hours and 20 non-active hours per day.
Small Linux AMI instance uses 8 GBytes EBS Volume the cost of $0.10 per GBytes per Month and $0.085 server charge per active hour. Therefore,
On-demand instance charge=12 days * 4 hours per day * $0.080 per hour = $3.84
EBS volume charge=(12 days / 30 days per month) * 8 GB * $0.10 per GB per month = $0.32
Elastic IP address charge=$0.01 / unused hour * 20 hours per day * 12 days = $2.40
Elastic IP remap charge=$0.00 since it is under 100 per month
Total Estimated Cost=$3,84 + $0.32 + $2.40 + $0.00 = $6.56
- Bonus exercise 1: Develop the above script and demonstrate it works.
- Bonus exercise 2: The API does not seem to provide ways to set Name of instances. The user_data option does not seem to set tag name-value pairs. See if you can find a good solution.
- Interesting info and resource:
- Interesting ec2 management tool sample written in ruby. http://developer.idapted.com/2010/06/30/amazon-ec2-management-tool/
- Stratus - Ruby IAM client library http://rubydoc.info/gems/stratus/1.0.1/frames
Part 3. Evaluate cost and performance trade off.
- Compared with the investment on the hardware/software of your own facility, the public cloud computing facilities have the following advantages and disadvantages:
- Pros: On-demand provisioning of servers, with data center georgraphically distributed (closer to the customers/users), low cost and quick start up time.
- Cons: One time charge unlike hardware or software investment can be reused for 3-4 years, less secure, hard to know if public cloud computing facilities really honor the service level agreement.
- For longer terms usage, it is also not clear whether the reserved-instance or on-demand usage will save more money. We need to consider the storage usage and elastic IP address mapping and inactive charge.
- Here is an example of cost calculation for an online degree offering using Amazon AWS and compared that with the private cloud facility.
- Assume you are setting up a site with one LInux server and one Windows 2008 server to provide computing and server facilities for a group of 60 students at Europe, students are allowed to access the system 6 hours during the evening for one month during their certificate program study. Recommend your design choice using Amazon AWS and calculate the cost (using excel spreadsheet). Make your own assumptions.
Ans:
The above spreadsheet needs to be adjusted with 2012 pricing (it was absed on 2011 pricing) and by
- entering service charges at AWS Ireland region,
- deciding whether to use reserved instance and selecting reservation period (one year term or 3 year term) to reduce on-demand instance hour rate, and
- selecting m1.small or m1.large instances for these two servers.
Based on the spreadsheet and service charge forumula, for small instances, the
one year reservation paid off after 6 months See the following cost figure comparison.
Three year reservation paid off right after 12 months.
The excel spreadsheet is available at cost calculation.
Note that if students also involve in creating virtual machines similar to our lvs cluster exercises than the investment on a private cloud can be considered. For example, a $19,000 Amazon EC2 yearly charge with three years could allow the purchase of two sets of a two decent servers with 16 core processors, 128GB total main memory, plus 7.2 TB SAN storage. One set is more than enough to take care of the need. However we did not add the infrastructure initial investment and maintenance expenses including power, air condition, networking, and IT staff support.