Clouds

Juju ships with the ability to seamlessly use a number of public clouds (including Amazon Web Services, Azure, Google Compute Engine, Joyent and Rackspace) to deploy workloads, as well as private clouds (e.g. OpenStack) which you configure.

The knowledge to run these public clouds is 'baked-in', so for the majority of use-cases there is no additional configuration to be done - you can simply specify the cloud you wish to use, supply Juju with some credentials and start deploying applications.

Listing available clouds

To see which clouds Juju currently knows about, you can run the command:

juju clouds

This will return a list like this:

Cloud        Regions  Default        Type        Description
aws               11  us-east-1      ec2         Amazon Web Services
aws-china          1  cn-north-1     ec2         Amazon China
aws-gov            1  us-gov-west-1  ec2         Amazon (USA Government)
azure             18  centralus      azure       Microsoft Azure
azure-china        2  chinaeast      azure       Microsoft Azure China
cloudsigma         5  hnl            cloudsigma  CloudSigma Cloud
google             4  us-east1       gce         Google Cloud Platform
joyent             6  eu-ams-1       joyent      Joyent Cloud
rackspace          6  dfw            rackspace   Rackspace Cloud
localhost          1  localhost      lxd         LXD Container Hypervisor

This lists the cloud name (which you will use to specify the cloud you want to use), its type (the API used to control it) and the default region for each cloud, so in the above, us-east-1 is the default region for an aws cloud.

To see which regions Juju currently knows about for a specific cloud, you can run the command, replacing aws with any of the clouds returned in the previous command:

juju regions aws

This will return a list like this:

us-east-1
us-west-1
us-west-2
eu-west-1
eu-central-1
ap-south-1
ap-southeast-1
ap-southeast-2
ap-northeast-1
ap-northeast-2
sa-east-1

This lists all of the regions available to you for the named cloud. To specify a different region, see Creating a controller.

Set the default region for a cloud with:

juju set-default-region aws eu-central-1

If you want more detail about a particular cloud, use:

juju show-cloud azure

Juju may have baked-in knowledge, but sometimes the recipe changes. Juju can also update its knowledge of public clouds, to take into account changes in the way clouds work, new regions or other aspects of their operation.

The command:

juju update-clouds

will fetch the latest information on supported public clouds. It is a good idea to run this periodically, or if you are sure there are additional regions/clouds Juju supports which are not currently listed.

Note: Juju can work with any OpenStack cloud, see the notes below for specifying additional clouds

Special clouds

There are three special types of clouds: MAAS, LXD and Manual.

  • LXD: This is the cloud you want to use if you are testing Juju or developing your own Juju charms - it is incredibly fast! LXD is a container hypervisor that runs on any Linux host, providing the ability to spin up containers on the host machine. For more details on using LXD, please see the LXD documentation.

  • MAAS: An acronym of Metal As A Service, MAAS lets you treat physical servers like virtual machines in the cloud. Rather than having to manage each server individually, MAAS turns your bare metal into an elastic cloud-like resource. There is more information on MAAS at the MAAS website, and detailed instructions on using MAAS with Juju here.

  • Manual: There may be occassions where you can bring up machines for Juju to use which aren't part of a recognised public cloud or do not support other protocols used by Juju. As long as you have SSH access to these machines, you can get part of the Juju magic and deploy applications. See this documentation for details on how to register these machines with Juju and use them as part of a cloud.

Specifying additional clouds

There are cases (an OpenStack cloud is a common one) where the cloud you want to use is not on Juju's list of known clouds. Juju usually only needs a small amount of information to be able to use these clouds too, so the fastest way to get them recognised is to use the add-cloud command in its interactive mode. This will ask a series of questions based on the type of cloud you are trying to add. Currently Juju can add MAAS, OpenStack, vSphere and manual clouds in this way - each is detailed below (click on the triangle or name to expand the relevant section). You can also generate a YAML file

MAAS

To add a MAAS cloud, Juju only needs to know the name you wish to call it, and the API endpoint used to connect to it. A sample session looks like this:

 juju add-cloud

 Cloud Types
  maas
  manual
  openstack
  vsphere

 Select cloud type: maas

 Enter a name for your maas cloud: mainmaas

 Enter the API endpoint url: http://maas.example.org:5240/MAAS/api/2.0

Cloud "mainmaas" successfully added
You may bootstrap with 'juju bootstrap mainmaas'

Once completed, you should also remember to add a credential for this cloud before bootstrapping. See the documentation on credentials for more help.

Manual

To add a 'manual' cloud, Juju only needs to know the name you wish to call it, and the network address used to connect to it. A sample session looks like this:

 juju add-cloud

 Cloud Types
  maas
  manual
  openstack
  vsphere

 Select cloud type: maas

 Enter a name for your maas cloud: mainmaas

 Enter the API endpoint url: http://maas.example.org:5240/MAAS/api/2.0

Cloud "mainmaas" successfully added
You may bootstrap with 'juju bootstrap mainmaas'

Once completed, you should also remember to add a credential for this cloud before bootstrapping. See the documentation on credentials for more help.

OpenStack

To add an OpenStack cloud, Juju needs to know the endpoints to connect to, the authorisation type to use and any region information. A sample session is shown below:

 juju add-cloud

 Cloud Types
  maas
  manual
  openstack
  vsphere

 Select cloud type: openstack

 Enter a name for your openstack cloud: devstack

 Enter the API endpoint url for the cloud: https://openstack.example.com:35574/v3.0/

 Auth Types
  access-key
  userpass

 Select one or more auth types separated by commas: access-key,userpass

 Enter region name: dev1

 Enter the API endpoint url for the region: https://openstack-dev.example.com:35574/v3.0/

 Enter another region? (Y/n): n

 Cloud "devstack" successfully added
 You may bootstrap with 'juju bootstrap homestack'

Note that it is possible to choose more than one authorisation method - just separate the values with commas.

Once completed, you should also remember to add a credential for this cloud before bootstrapping. See the documentation on credentials for more help.

vSphere

To add a cloud based on VMWare's vSphere, Juju needs to know how to connect to it and what to call the cloud. :

 juju add-cloud
 Cloud Types
   maas
   manual
   openstack
   vsphere

 Select cloud type: vsphere
 Enter a name for your vsphere cloud: vs1

 Enter the API endpoint url for the cloud: 178.18.42.10

 Enter region name: dc0

 Enter another region? (Y/n): y

 Enter region name: dc1

 Enter another region? (Y/n): n

 Cloud "vs1" successfully added
 You may bootstrap with 'juju bootstrap vs1'

The èndpoint address in this case is the IP address of the vSphere server. In this case we have also specified multiple regions (data centres in vSphere terminology).

Once completed, you should also remember to add a credential for this cloud before bootstrapping. See the documentation on credentials for more help.

Manually specifying additional clouds

In this case it is possible to create a YAML formatted file with the information Juju requires and import this new definition. The file should follow this general format:

clouds:
  <cloud_name>:
    type: <type_of_cloud>
    auth-types: <[access-key, oauth, userpass]>
    regions:
      <region-name>:
        endpoint: <https://xxx.yyy.zzz:35574/v3.0/>

with the releavant values substituted in for the parts indicated (within '<' '>').

For example, a typical OpenStack cloud on the local network you want to call 'mystack' would appear something like this:

clouds:
    mystack:
      type: openstack
      auth-types: [access-key, userpass]
      regions:
        dev1:
          endpoint: https://openstack.example.com:35574/v3.0/

In this case the url is at https://openstack.example.com:35574/v3.0/, and the cloud accepts either access-key or username/password authentication methods.

With the yaml file saved, you can now import this information into Juju like so:

juju add-cloud mystack mystack.yaml

Note that the name you give your cloud MUST match the value given inside the YAML file you created.

Having added a new cloud, if you re-run the juju clouds command, you should see something like this:

Cloud        Regions  Default        Type        Description
aws               11  us-east-1      ec2         Amazon Web Services
aws-china          1  cn-north-1     ec2         Amazon China
aws-gov            1  us-gov-west-1  ec2         Amazon (USA Government)
azure             18  centralus      azure       Microsoft Azure
azure-china        2  chinaeast      azure       Microsoft Azure China
cloudsigma         5  hnl            cloudsigma  CloudSigma Cloud
google             4  us-east1       gce         Google Cloud Platform
joyent             6  eu-ams-1       joyent      Joyent Cloud
rackspace          6  dfw            rackspace   Rackspace Cloud
localhost          1  localhost      lxd         LXD Container Hypervisor
mystack            1  dev1           openstack   Openstack Cloud