LibraryPrintFeedback

Cloud Computing with Fabric

Version 7.1

December 2012
Trademark Disclaimer
Third Party Acknowledgements

Updated: 08 Jan 2014

Table of Contents

1. Amazon EC2 Tutorial
Overview of the Tutorial
Open an Amazon EC2 Account
Set Up an SSH Key Pair
Initialize Your Local Container
Register the Amazon EC2 Provider
Create a Fabric Server
Provision Containers
Monitor Instances with JMX
Terminate Instances

JClouds is an open-source library that enables you to administer cloud providers remotely. It provides modules for communicating with a great variety of cloud providers. FuseSource supports only the Amazon and Rackspace providers, however, which can be accessed by installing the following JClouds features in your container:

jclouds-aws-ec2
jclouds-cloudservers-us
jclouds-cloudservers-uk

This tutorial assumes you have a fresh installation of Fuse ESB Enterprise on your local machine (see Installation Guide). If you have previously experimented with the local container instance, it might be a good idea to perform a cold start before you proceed.

(Optional) If you are not sure what state your local container is in or if you have previously used your local container in the context of a fabric, it is a good idea to force a cold start before you continue. This ensures that your container is in a known state (a plain, unmanaged container) and makes it more likely that you will be able to follow the tutorial steps without any problems.

To force a cold start, perform the following steps:

  1. If the container is currently running, shut it down by entering the following console command:

    karaf@root> shutdown -f
    [Note]Note

    If your container has any child instances running, you must also shut the child instances down. On *NIX systems, you could use the command ps -ef | grep karaf to discover any child instances.

  2. Delete the ESBInstallDir/data/ directory.

    [Warning]Warning

    This will completely wipe the state of the container (apart from the configuration settings stored under ESBInstallDir/etc/).

    [Note]Note

    If your container has any child instances, you must also delete the ESBInstallDir/instances/ directory, which contains the data for the child instances.

  3. Start the container by entering the following commands:

    cd ESBInstallDir/bin
    ./fuseesb

If you do not already have an AWS Access Key (which consists of an Access Key ID and a Secret Access Key), create a new Access Key as follows:

  1. Use your Web browser to navigate to http://aws.amazon.com/

  2. Move your mouse to the My Account/Console drop-down menu and select the Security Credentials menu item.

  3. If you are not already logged on to AWS, you are now prompted to log on using the account details you specified in Open an Amazon EC2 Account.

  4. Expand the Access Keys section and click Create New Access Key.

  5. The Create Access Key Dialog appears. Click Download Key File and save the downloaded file, rootkey.csv, to a secure location on your filesystem.

    [Note]Note

    This is the only chance you get to download the Secret Access Key from AWS. If you lose the key at this point, you cannot retrieve it later (you would then need to create a new Access Key).

All of the containers in the fabric have JMX enabled by default. To monitor a Fabric Container with JConsole, proceed as follows:

  1. In the local container, use the fabric:container-list console command to obtain the JMX connection URLs for all of the containers, as follows:

  2. In an O/S command prompt, enter the following command to start up JConsole:

    > jconsole
  3. Copy one of the (rather long) JMX connection URLs from step 1 and paste it into the Remote Console text field of the JConsole: New Connection dialog. In the Username field, type admin; and in the Password field, type admin. Click Connect.

  4. JConsole now establishes a JMX connection to the cloud container. Click on the MBeans tab to explore the status of applications running in the container.

You can quickly terminate all of your compute instances on the EC2 cloud using the jclouds:node-destroy-all command, as follows:

karaf@root> jclouds:node-destroy-all
[Note]Note

This example assumes that your entire fabric is hosted in the cloud, so that you do not need to worry about the consistency of registry entries when you delete it. This approach would not be appropriate, however, if you have a fabric that overlaps with host machines outside the cloud.