We have seen consistently growing interest in running Resin on Amazon EC2. EC2 is an Infrastructure as a Service (IaaS). It provides hardware, networking, load balancing, connectivity, storage and virtualized OS hosting. Resin 4 includes cloud support features that make deploying to EC2 simple and painless. Resin offers dynamic clustering, load balancing and versioned deployment. A comprehensive health monitoring system provides visibility into the status of your entire application stack. Furthermore, comparing Resin to PaaS providers, Resin is really a PaaS-ready application server; one that will run well on an IaaS service like Amazon EC2.
This is part two of a tutorial on using Amazon EC2 and Resin to do cloud deployment. This tutorial is going to cover the basics of using Resin with Amazon Web Services for cloud deployment. If you are new to cloud computing and IaaS, follow along and you will soon be deploying Java web applications in the cloud.
RunningÂ Euca Tools to launch Amazon EC2 instances.
Make sure to complete part 1 first.
This is an extension of this tutorial Resin Cloud Deployment with Amazon EC2.
Setup Euca Tools on Ubuntu local box
Create ~/.eucarc file
In home dir createÂ .eucarc file with the following contents. To get the EC2_ACCESS_KEY and the EC2_SECRET_KEY go to the Amazon WS home then go to theÂ Account Tab then go toÂ Security Credentials. You should access key and the secret key. Click around. It is there.
Create a new Amazon Linux instance
We are going to create an Amazon Linux instance, which we can describe as follows:
Now we need to import the resin2 key. Your key pair might be named different as you set this up with Amazon as part of the initial trail setup (documented in the first tutorial linked to the Amazon documentation).
Create properties file as follows user-data.properties in the home directory.
Now startup a new instance with the above user properties.
The instance id is i-577b5834.
To get the instance you just ran do the following:
The first column is the instance identifier. The second column is the public IP address. The third column is the timestamp the instance started.
The instance id isÂ i-577b5834. You can use the instance id to get a copy of the public DNS for this instance.
Install Resin on the Amazon AMI instance we just started
Once you know the URL you can log into the box with ssh.
Installed Resin on Remote Amazon box.
Create Create an amazon.xml on the Amazon AMI instance. Add the below toÂ /etc/resin/local.d/amazon.xml
Deploy the Roo example from the example dir
On Local Ubuntu box
Now your app should be ready to go.