G-Eclipse/AWS Cloud in headless mode
API for the Cloud
The g-Eclipse project provides an integrated project view to Grid and Cloud infrastructures. With the help of the created "Grid-Project", the users is able to interact with Grid and Cloud infrastructures. The g-Eclipse framework contains the exemplary implementation for the Amazon Web Services, but the framework is generic to integrate other Cloud infrastructures too.
The architecture of the g-Eclipse framework is designed to be able to run the core of the g-Eclipse framework independent from the UI parts. With the feature, the core g-Eclipse framework provides a generic API for Cloud computing allowing to start and stop remote Cloud instances as well as management of data on the infrastructures.
In this tutorial, we demonstrate the usage of the g-Eclipse framework in headless mode.
This tutorial shows the usage of the g-Eclipse core components together with the AWS web services. In order to perform the tutorial, the user requires a valid AWS account including the following features:
- The AWS Access Credentials from AWS called "Access Key ID" and the "Secret Access Key"
- The name of a Amazon Machine Image (AMI) which can be started by the user. The AMI name can be a private one or a public one.
- The name of a valid AWS Security Group. This security group can be seen as a firewall configuration for running Amazon Computing instances.
- The name of a valid AWS Keypair in order to enable the login to the running AMI instance later.
If you tried the g-Eclipse framework in UI mode, you can get parts of the required information with the help of the g-Eclipse Grid project view.
We start with a plain Eclipse installation and import the following plugin projects in the workspace.
From the g-Eclipse SVN repository we need:
From the Orbit CVS repository we need
From the SMILA SVN repository we need from tag 0.5M1
Or you just download this Media:AWSCloudHeadless.psf project set to import the required projects.
IN order to demonstrate the use of the g-Eclipse core framework in headless mode, we create a simple plugin project and start an instance of EC2 with every start of the instance. So please do the following:
- Create an new plugin project and name it "eu.geclipse.demo.headless" and click "Next"
- Deactivate the option "This plug-in will make contributions to the UI" because we don't want!
- Click Finish!
Then open the Activator of the plugin "eu.geclipse.demo.headless.Activator" in the editor and add the following code in the
start<\code> method. First define the Access keys and use the your personnel ones.
System.out.println(" Start AWS demo headless "); String aws_accessId = "Access Key ID"; String aws_secretkey = "Secret Access Key";
Then create a Virtual Organisation (VO). A VO can be seen as a virtual data center composed by computing resources, storage resources and additional services. We define a AWS VO flavor and use the Access Key ID to define it. With the following code line the VO is created and put into the g-Eclipse core model.
IVirtualOrganization vo = null; IVoManager manager = GridModel.getVoManager(); AWSVoCreator creator = new AWSVoCreator(); creator.setVoName("aws-vo"); creator.setAwsAccessId(aws_accessId); vo = (IVirtualOrganization) manager.create(creator); System.out.println(" VO created");
The next step is the creation of an Authentication Token valid for the VO. This is done with the following code lines.
PasswordManager.registerPassword(AWSAuthTokenDescription.SECURE_STORAGE_NODE + aws_accessId, aws_secretkey); IAuthenticationTokenDescription desc = new AWSAuthTokenDescription( (AWSVirtualOrganization) vo); AuthenticationTokenManager tokenManager = AuthenticationTokenManager.getManager();