About Pascal Alma

Pascal is a senior JEE Developer and Architect at 4Synergy in The Netherlands. Pascal has been designing and building J2EE applications since 2001. He is particularly interested in Open Source toolstack (Mule, Spring Framework, JBoss) and technologies like Web Services, SOA and Cloud technologies. Specialties: JEE, SOA, Mule ESB, Maven, Cloud Technology, Amazon AWS.

Working with Amazon Web Services (EC2)

As posted before I attended to a technical handson AWS training last week. The subjects during these days were of course the standard EC2 and S3 services which I have used before. Added to that we worked with RDS, Elastic Load Balancing, SNS and VPC, Elastic Beanstalk and discussed a lot of terminology and business cases. In this post I setup a new EC2 server and connect to it with your MacOs although it will work similar in case of Linux. I have an account at AWS in place. Before you start make sure you have selected the correct region (for a simple demo it isn’t very big thing but when you are going to setup a real server it can make a big difference in the costs (network traffic) and latency although there are solutions for that). By the way, there are two approaches to setup your EC2 server, you can choose a “S3 backed” AMI (Amazon Machine Image) or a “EBS-bakced” AMI. There are a lot of good articles
available about the differences and when to use which one. In this demo I will install a “pre-baked” AMI with a complete WordPress setup installed. There are thousands of these AMI’s available in the AWS community. For this one launch the AWS Management Console at http://aws.amazon.com and choose the EC2 tab. In the AWS console make certain you selected the correct region and select ‘Images-AMIs’ in the left menu and search for “bitnami-wordpress”:

Screen Shot 2012-12-09 at 08.05.04

Select the AMI of your choice (I have 64-bit Ubuntu running WordPress and click ‘Launch’. Now simply follow the steps of the wizard (although there is a lot to tell about almost every option in the wizard I simply go for the most default installation). At the Instance Details step make sure you select a Micro instance (to cut down the cost of having this demo running):

Screen Shot 2012-12-09 at 08.15.57

In the next two steps simply accept all defaults:

Screen Shot 2012-12-09 at 08.16.47

Screen Shot 2012-12-09 at 08.17.12

At the Create Key Pair step create a key pair if you haven’t already done so:

Screen Shot 2012-12-09 at 08.19.19

The next step Configure Firewall create a Security Group so we are able to access our Linux instance from the outside world by HTTP and SSH:

Screen Shot 2012-12-09 at 08.21.36

Finally review all your settings and if it is okay then launch the instance:

Screen Shot 2012-12-09 at 08.22.31

After a few seconds you should be able to see your new instance in the Instances overview in the AWS Management Console:

Screen Shot 2012-12-09 at 08.29.57

Please pay specific attention to the public DNS that is assigned to the instance. As you might be aware this DNS will change after you stopped and started this instance. So I use it now to show how to connect to the instance via SSH but you should not use this DNS as if it was a fixed IP/DNS. To work around this issue Amazon supplies Elastic IP which I show in another post.

To connect with SSH to this instance open up a Terminal on your Mac and type the following commands. First I had to narrow the permissions on the downloaded pem file for which I used: chmod u=r,go= 4synergy_palma.pem Then I was able to connect to the Bitnami instance via SSH with: ssh -i 4synergy_palma.pem bitnami@ec2-54-246-78-211.eu-west-1.compute.amazonaws.com as you can see here:

Screen Shot 2012-12-09 at 09.08.39

And of course we can enter our WordPress by opening the home URL in a web browser:

Screen Shot 2012-12-09 at 09.15.20

Reference: Working with Amazon Web Services (EC2) from our JCG partner Pascal Alma at the The Pragmatic Integrator blog.

Related Whitepaper:

Host Your Web Site in the Cloud

A step-by-step guide to this revolutionary approach to hosting and managing your web applications!

Cloud computing gives you the tools you need to prepare and cope with a traffic onslaught. You'll have the confidence to withstand a traffic surge without melting your servers or sending you into bankruptcy. There are a number of different ways to use the cloud to host existing applications, build creative new ones, and improve the cost-effectiveness and efficiency of organizations large and small.

Get it Now!  

Leave a Reply

× two = 2

Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books