9.3. fabric:cloud-service-add

Abstract

initialize a cloud provider (which can be used for provisioning containers in the cloud)

Synopsis

fabric:cloud-service-add [ --help ] [ --provider providerName ] [ --name name ] [ --api APIName ] [ --endpoint URL ] [ --identity accessKeyID ] [ --credential secretAccessKey ] [ --owner owner ] [ --option key=value ] [ --async-registration ]

Description

This command runs asynchronously. That is, although the command returns immediately, it runs a thread in the background, which completes the initialization of the cloud provider. You can use fabric:cloud-service-list to discover when the initialization has completed.
There are two different styles of usage for this command:
  • Commercial cloud provider—if you are using a commercial cloud provider, JClouds provides prepackaged modules that encapsulate the basic connection details for the provider. The prepackaged modules are available to install as Karaf features (named jclouds-ProviderName) and encapsulate such details as the endpoint URI, cloud API, and so on.
    For example, to install an Amazon Web Services (AWS) EC2 cloud provider, you can perform the following steps (assuming you are working in a standalone container):
    1. Install the basic set of fabric cloud commands:
      karaf@root> features:install fabric-jclouds
    2. Install the JClouds module specifically for AWS EC2:
      karaf@root> features:install jclouds-aws-ec2
    3. Add the AWS EC2 provider, specifying the login credentials for your EC2 account:
      karaf@root> fabric:cloud-service-add --provider aws-ec2 --identity AccessKeyID
      --credential SecretAccessKey
    4. You are now ready to start creating compute instances on the aws-ec2 cloud service, using the fabric:container-create-cloud command.
  • Private cloud service—if you are hosting your compute instances on a private cloud service, you must specify the connection details more explicitly, by supplying the --api and --endpoint options. In this case, you must also define a name for the cloud service, by supplying the --name option.
    For example, to define a connection to a private cloud service that uses the openstack-nova API through the endpoint, http://172.16.0.1:4000/v2.0/, you can perform the following steps (assuming you are working in a standalone container):
    1. Install the basic set of fabric cloud commands:
      karaf@root> features:install fabric-jclouds
    2. Install the JClouds module for the openstack-nova API:
      karaf@root> features:install jclouds-api-openstack-nova
    3. Add the private cloud service, specifying the login credentials, API, and endpoint URL:
      karaf@root> fabric:cloud-service-add --name myOpenStack --api openstack-nova
      --endpoint http://172.16.0.1:4000/v2.0/ --identity AccessKeyID --credential SecretAccessKey
      Note
      You can provide additional customisation of the connection by setting options through the --option flag (which can appear multiple times in the command).
    4. You are now ready to start creating compute instances on the myOpenStack cloud service, using the fabric:container-create-cloud command.

Installing the command in a fabric

To access this command from a fabric container, you must have installed the fabric-jclouds feature. To install the fabric-jclouds feature, deploy the cloud profile into the current container, using the fabric:container-change-profile command.
For example, if the console is currently logged on to the root container of the Fabric, you could add the cloud profile as follows:
JBossA-MQ:karaf@root> fabric:container-list
[id]                           [version] [alive] [profiles]                     [provision status]
root*                          1.0       true    fabric, fabric-ensemble-0000-1 success
JBossA-MQ:karaf@root> fabric:container-change-profile root fabric fabric-ensemble-0000-1 cloud
JBossA-MQ:karaf@root> fabric:container-list
[id]                           [version] [alive] [profiles]                     [provision status]
root*                          1.0       true    fabric, fabric-ensemble-0000-1, cloud success

Arguments

Table 9.3, “fabric:cloud-service-add Arguments” describes the command's arguments.

Table 9.3. fabric:cloud-service-add Arguments

ArgumentInterpretation
--help Displays the online help for this command.
--provider The name of a commercial cloud provider (for example, aws-ec2 or rackspace).
--nameThe JClouds service context name, which identifies the cloud service uniquely. Defaults to the provider name (as specified by the --provider option).
--apiSpecifies the cloud API (for example, ec2, openstack-nova, or cloudstack).
--endpointSpecifies the cloud service's endpoint URL.
--identityThe identity used to access the cloud service.
--credentialThe credential used to access the cloud service.
--owner Specifies the EC2 AMI owner, which enables you to use private images (AWS EC2 only).
--optionProvider-specific properties. For example: --option jclouds.regions=us-east-1. If you want to specify more than one option, specify this option multiple times.
--async-registration Do not wait for the provider registration (that is, complete the registration in a background thread).