Friday, August 12, 2011

Getting started with Amazon's Elastic Compute Cloud (EC2) and the Bitnami Tomcat Stack

My next couple of blog posts will detail my experiences thus far with Amazon's Elastic Computing Cloud (Amazon EC2) and the Bitnami TomcatStack Amazon Machine Image (AMI).

Choosing Amazon's EC2

In the past, I have typically deployed my Java applications within a company intranet or extranet.  However,  my current project needs to be publicly accessible and it's up to me to choose a suitable and ultra-affordable web hosting provider.

My hosting requirements are fairly simple.  I want to deploy my application on Apache Tomcat using a MySQL database and several popular Java frameworks including Hibernate, Struts 2, and eventually Spring.  Other than that, I don't expect my current web application to require much in terms of bandwidth and resources.

I was considering trying Google's App Engine until I learned the App Engine doesn't support the Hibernate ORM framework and requires some tweaking to work with Struts 2.

I began to look more closely at Amazon's EC2 service after reading several StackOverflow posts (here and here) suggesting EC2 as an alternative to traditional web hosting services for Java applications.  I soon learned that Amazon offers a Free Usage Tier for new customers.  As described on their website, the "free usage tier can be used for anything you want to run in the cloud: launch new applications, test existing applications in the cloud, or simply gain hands-on experience with AWS."

At first, getting started with EC2 initially seemed a like daunting task.  I explored using Amazon's Elastic Beanstalk which is promoted as "an even easier way for you to quickly deploy and manage applications in the AWS cloud."  However, I couldn't find any documentation or examples of using Beanstalk with MySQL.  The examples I found used the Amazon SimpleDB and it wasn't clear whether I could easily use SimpleDB with Hibernate.  Lacking a clear understanding of how to use Beanstalk with MySQL I decided not to try Beanstalk.  (Note: Please let me know if you have used Beanstalk with MySQL or if you've found some resources on this topic.  Thanks!)

Choosing an Amazon Machine Image (AMI)

After creating an Amazon AWS account, it was time to select and launch a server instance on the EC2.  But which AMI should I select for my EC2 instance?  There are thousands of Community AMI's, hundreds of which are listed as free tier eligible.

Here's a useful blog post I found describing the steps necessary to select and install Java, Tomcat, and MySQL.  The blog author chose the Amazon Linux AMI.  This AMI is a good starting point and is actively supported by Amazon.  "Amazon Web Services also provides ongoing security and maintenance updates to all instances running the Amazon Linux AMI. The Amazon Linux AMI is provided at no additional charge to Amazon EC2 users."

But alas, is there an even easier way to get started?  With all those Community AMI's out there can I find one that bundles Linux, Java, Apache, Tomcat and MySQL.  The answer is yes!  The Bitnami Tomcat Stack "includes ready-to-run versions of Apache, Tomcat, MySQL and Java and required dependencies" and "is distributed for free under the Apache 2.0."  Nice!

Bitnami also offers a Cloud Hosting service which in conjunction with the Amazon EC2 provides a number of ease-of-use benefits.  However, it is not required to use the Bitnami Cloud Hosting service when selecting one of their free Community AMI's.

In my next blog post I'll explain the process of creating and connecting to the Amazon EC2 instance.

5 comments:

  1. Thanks a lot! I was in a similar situation and your post helped a lot...

    ReplyDelete
  2. DreamHost is definitely the best web-hosting provider with plans for all of your hosting needs.

    ReplyDelete
  3. Nice work, your blog is concept-oriented, kindly share more
    AWS Online Training

    ReplyDelete
  4. Amazon Elastic Compute Cloud (EC2) forms a central part of Amazon.com's cloud-computing platform, Amazon Web Services (AWS), by allowing users to rent virtual computers on which to run their own computer applications. EC2 encourages scalable deployment of applications by providing a web service through which a user can boot an Amazon Machine Image (AMI) to configure a virtual machine, which Amazon calls an "instance", containing any software desired.
    Amazon elastic compute cloud

    ReplyDelete
  5. Thanks for sharing this post. Your post is really very helpful its students. google cloud online training

    ReplyDelete