Resin Cloud deployment with Amazon WS EC2 and Euca Tools

From Resin 3.0

Jump to: navigation, search

Running Euca Tools to launch Amazon EC2 instances.

This is an extention of this tutorial [Resin Cloud Deployment with Amazon EC2].


Setup Euca Tools on Ubuntu local box

Install tools:

$ sudo apt-get install -y euca2ools

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.

rick@ubuntu:~$ cat .eucarc

Create a new Amazon Linux instance

We are going to create an Amazon Linux instance, which we can describe as follows:

$ euca-describe-images | grep "ami-1b814f72"

IMAGE     ami-1b814f72     amazon/amzn-ami-2011.09.2.x86_64-ebs     137112412989     available     public          x86_64     machine     aki-825ea7eb           ebs

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).

$ euca-add-keypair resin2 > priv.ec2.key
$ chmod 600 priv.ec2.key

Create properties file as follows in the home directory.

log_level     : info
dev_mode      : true
resin_doc     : true

app_tier      :
web_tier      :
cache_tier    :

setuid_user   : resin
setuid_group  : resin

http          : 8080
https         : 8443

admin_user : admin
admin_enable : true
admin_password : {SSHA}BGBKQdCr0a5orH99eqIFwR/fffffffff
admin_external : true
admin_remote_enable : true 
session_store : true

Now startup a new instance with the above user properties.

$ euca-run-instances ami-1b814f72 -t t1.micro -k resin2 --user-data-file
RESERVATION     r-c3c326a2     972637075895     default
INSTANCE     i-577b5834     ami-1b814f72               pending     resin2     0          t1.micro     2011-11-30T00:53:06.000Z     us-east-1a     aki-825ea7eb

The instance id is i-577b5834.

$ euca-create-tags i-577b5834 --tag Name=resinserver
TAG     i-577b5834     Name     resinserver

To get the instance you just ran do the following:

$ euca-describe-instances --filter "instance-state-name=running" --filter "image-id=ami-1b814f72" | grep INSTANCE | awk '{print $2, $4, $10}'
i-577b5834 2011-11-29T23:28:18.000Z

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.

$ euca-describe-instances i-577b5834 | grep INSTANCE | awk '{print $4}'

Install Resin on the Amazon AMI instance we just Started

Once you know the URL you can log into the box with ssh.

$ ssh -i resin2.pem

Installed Resin on Remote Amazon box.

$ sudo rpm --import 
$ sudo yum install

Create Create an amazon.xml on the Amazon AMI instance. Add the below to /etc/resin/local.d/amazon.xml

<resin xmlns=""

  <resin:properties path=""


Deploy the Roo example from the example dir

On Local Ubuntu box

$ resinctl deploy target/blog-0.1.0.BUILD-SNAPSHOT.war -name blog -address -port 8080 -user admin -password roofoo

Deployed production/webapp/default/blog from target/blog-0.1.0.BUILD-SNAPSHOT.war to admin@aaa.app_tier.admin.resin/133f37dc81f

Now your app should be ready to go.

Using Botto To Run and Manage Amazon AMI Instances

Personal tools