Monday, January 16, 2012

Amazon announces free tier instance Windows AMI

Amazon announces today that "AWS Free Usage Tier will now include Amazon EC2 instances running Microsoft Windows Server. Customers eligible for the AWS Free Usage tier can now use up to 750 hours per month of t1.micro instances running Microsoft Windows Server for free."

Tuesday, January 10, 2012

Cloud Computing vs Virtualization

Cloud Computing and virtualization are often mentioned together and I have been asked what is the difference between the two recently. There are overlaps for sure. Cloud Computing delivers computing as a pay-per-use service that is based on a pool of virtualized computing resources. Cloud Computing is more from an end user and business perspective while virtualization is more from technology and hardware management perspective.  Virtualization a technology that is available in several forms to allow technical resources to be separated from the physical servers they run on and treated as an abstraction layer. Virtualization is a key part of cloud computing. Amazon AWS is an example of Cloud Computing service.

Tuesday, January 3, 2012

Steps for creating automatic startup/shutdown scripts for Tomcat in Amazon EC2

After Tomcat is installed in EC2, it's time to create a startup/shutdown service script. Below are steps:
  1. login to EC2 instance with putty
  2. sudo su
  3. cd /etc/init.d
  4. vim tomcat
  5. put following into the file  
  6. #!/bin/bash
    # chkconfig: 234 20 80
    # description: Tomcat Server basic start/shutdown script
    # processname: tomcat
    export JAVA_HOME
    start() { echo -n "Starting tomcat: "
    echo "done." }
    stop() { echo -n "Shutting down tomcat: "
    ${STOP_TOMCAT} echo "done." }
    case "$1" in
    sleep 10
    echo "Usage: $0 {start|stop|restart}"
    exit 0
  7. Change permissions.  chmod 755 tomcat
  8. Add script to system services. chkconfig --add tomcat
  9. Test it out. service tomcat start, service tomcat stop.

Monday, January 2, 2012

Create Swap Space in Amazon EC2 instance

Just found out my Amazon EC2 micro instance does not have any swap space. The memory comes with the micro instance is enough for a regular PHP app, but not enough for any J2EE application. It's time to add a file system swap. Below are steps for creating a swapfile:
  1. login as ec2-user with putty.
  2. sudo su
  3. dd if=/dev/zero of=/swapfile bs=1024 count=1048576
  4. /sbin/mkswap /swapfile
  5. /sbin/swapon /swapfile
  6. /sbin/swapon -s

Sunday, January 1, 2012

Install Tomcat to Amazon EC2 instance

To install Tomcat, first we need to install a JDK. Steps to install JDK.
  1. Login to AWS EC2 instance with putty.
  2. sudo su
  3. Create a directory for Java installation. cd /usr/share, mkdir java, cd java.
  4. Download a JDK from Oracle.  wget 
  5. Install it. tar -xzf jdk-7u2-linux-i586.tar.gz
  6. Test it. /usr/share/java/ jdk1.7.0_02/bin/java -version.
Install Tomcat.
  1. Download Tomcat to /usr/share directory. wget
  2. Install Tomcat. tar -xzf apache-tomcat-7.0.23.tar.gz
  3. set JAVA_HOME $env in cd /usr/share/apache-tomcat-7.0.23/bin,
    vi and add following line after the first line. JAVA_HOME=/usr/share/java-1.7.0/jdk1.7.0_02
  4. Start it. ./ Check log and fix errors if any.
Next I will talk about creating a startup/shutdown script.