How to add a cloud

See also:

Juju needs to know how to connect to clouds. The process of adding a cloud consolidates information about the cloud’s endpoints and authentication requirements into a cloud definition file.

This page contains information about adding clouds with the add-cloud command, which has both an interactive mode as well as a manual mode.


Adding clouds interactively

For new users, interactive mode is the recommended method for adding a cloud. This mode currently supports the following clouds: MAAS, Manual, OpenStack, Oracle, and vSphere.

To start the wizard, enter:

juju add-cloud

Adding clouds manually

More experienced Juju administrators can add their clouds manually. This can assist with automation.

Specific guides on manually adding a cloud can be found here:

Creating the YAML file

The manual method uses a YAML configuration file with the following format:

    type: <cloud type>
    auth-types: [<authenticaton types>]
        endpoint: <https://xxx.yyy.zzz:35574/v3.0/>

The table below shows the authentication type available for each cloud type. It does not include the interactive type as it does not apply in the context of adding a cloud manually.

cloud type authentication type
azure service-principal-secret
ec2 access-key
gce jsonfile,oauth2
lxd n/a, certificate (v.2.5)
maas oauth1
manual empty
oci httpsig
openstack access-key,userpass
oracle userpass
vsphere userpass

To add a cloud manually, we supply the path to the configuration as an argument:

juju add-cloud --local <cloud-name> -f <cloud-file>

In versions prior to v.2.6.1 the add-cloud command only operates locally (there is no --local option).

Managing multiple clouds with one controller

A cloud can be added to an existing controller, thereby saving a machine and the trouble of setting up a controller within that cloud.

For example, to manage a MAAS cloud with a LXD controller making the controller "multi-cloud:

juju bootstrap localhost lxd
# Add MAAS cloud to the local client.
juju add-cloud --local maas -f maas-cloud.yaml
juju add-credential maas -f maas-credentials.yaml
# Add the same MAAS cloud to the LXD controller.
juju add-cloud --controller lxd maas

The output to the list-clouds command becomes:

Clouds on controller "lxd":

Cloud      Regions  Default    Type  Description
localhost        1  localhost  lxd   
maas             0             maas

A Kubernetes cluster can be added to an existing controller. Assuming you have a kube config with cluster credentials, adding a new controller cloud called “k8s-cloud” would be as simple as:

juju add-k8s k8s-cloud --controller lxd

And vice-versa, in a situation where services running on Kubernetes needed to interact with a stateful workload running on metal, a traditional cloud can be added to a controller running on Kubernetes.

juju bootstrap microk8s mk8s
juju add-cloud maas -f maas-cloud.yaml --controller mk8s --force
juju add-credential maas -f maas-credentials.yaml --controller mk8s

Both controller machine and workload machine(s) must be able to initiate a TCP connection to one another. There are also latency issues that may make some scenarios infeasible.

New cloud-based ‘add-model’ permissions can be set up via new commands grant-cloud and revoke-cloud.

When adding a model on a multi-cloud controller specifying the cloud name is mandatory. To continue with the example above then, to add model ‘xanadu’ to the ‘maas’ cloud:

juju add-model xanadu maas

Last updated 16 days ago.