此内容没有您所选择的语言版本。
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):- Install the basic set of fabric cloud commands:
karaf@root> features:install fabric-jclouds
- Install the JClouds module specifically for AWS EC2:
karaf@root> features:install jclouds-aws-ec2
- 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
- You are now ready to start creating compute instances on the
aws-ec2
cloud service, using thefabric: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 theopenstack-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):- Install the basic set of fabric cloud commands:
karaf@root> features:install fabric-jclouds
- Install the JClouds module for the
openstack-nova
API:karaf@root> features:install jclouds-api-openstack-nova
- 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
NoteYou can provide additional customisation of the connection by setting options through the--option
flag (which can appear multiple times in the command). - You are now ready to start creating compute instances on the
myOpenStack
cloud service, using thefabric: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.
Argument | Interpretation |
---|---|
--help | Displays the online help for this command. |
--provider | The name of a commercial cloud provider (for example, aws-ec2 or rackspace ). |
--name | The JClouds service context name, which identifies the cloud service uniquely. Defaults to the provider name (as specified by the --provider option). |
--api | Specifies the cloud API (for example, ec2 , openstack-nova , or cloudstack ). |
--endpoint | Specifies the cloud service's endpoint URL. |
--identity | The identity used to access the cloud service. |
--credential | The credential used to access the cloud service. |
--owner | Specifies the EC2 AMI owner, which enables you to use private images (AWS EC2 only). |
--option | Provider-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). |