Getting Started

Quick Start Guides

Release Notes

Maven Sites and Javadocs

User Guides

Samples & Examples

FAQs

Reference

Developer Resources

Old versions

Release Notes

Maven Sites and Javadocs

Frequently Asked Questions - JClouds EC2 integration

How to use your keypair with EC2 AMI

Amazon doesn't store the private key data, so if you supply an existing public key for jclouds to use, you'll also need to supply the private key correlating to it.

There are two ways you can tell jclouds to use your keypair for an EC2 AMI.

The preferable way is to just pass it as Template Option. If you are using an image where jclouds doesn't know the login user, you'll need to specify the option.overrideCredentialsWith and pass along the user that's baked in.

overrideLoginCredentialWith(your_id_rsa_string)
overrideCredentialsWith(new Credentials("root", your_id_rsa_string))

If you want to authorize your keypair, you can use the auhtorizePublicKey(yourKey) method

client.createNodesInGroup(group, 1, authorizePublicKey(myKey));

Here's how you can run a script using the overrideLoginCredentialsWith

templateOptions.runScript(_script_). authorizePublicKey().overrideLoginCredentialWith(private)

Keep in mind that authorizePublicKey() is redundant, if it is the same as what corresponds to the keyPair() option.

With respect to the security group, jclouds creates a security group for you, with rules corresponding to the inboundPorts() option (defaults to open port 22), unless you use the option EC2TemplateOptions.securityGroups().

The other way is the push your credentials into the credentials store so that jClouds uses it.

When a keypair is automatically created, jclouds puts the keypair into the Credentials Map. You can use the same option to put your credentials into the Credentials Map using the credentialStore

ComputeServiceContext.credentialStore

Note, the more you use features like security groups and keypairs, the less portable your code will be across clouds.