How to deploy to a specific availability zone
See also: Zone
If the backing cloud substrate supports multiple availability zones, users can explicitly specify which availability zone (or zones) to use when spinning up machines during a deploy operation. This can be done via a constraint or a placement directive.
One way to select specific availability zones is via constraints. This can be done by running
juju deploy, or
juju add-machine with the
--constraints option with the
For instance, here we create two Trusty machines in a certain zone:
juju add-machine -n 2 --series trusty --constraints zones=us-east-1a
We then deploy an application on two new machines in a different zone:
juju deploy redis -n 2 --constraints zones=us-east-1c
Finally, in order to deploy units to the two empty machines in the initial zone we first change the application constraint default (set implicitly with the
juju set-constraints redis zones=us-east-1a juju add-unit redis -n 2
When multiple (comma separated) values are used, the constraint is interpreted as being a range of zones where a machine must end up in.
Another way to select a specific availability zone is via a placement directive.
This method overrules selections made via a constraint.
To do this, run
juju add-machine ,
juju add-unit , or
juju enable-ha with the
--to option and the
zone key. For example:
juju bootstrap --to zone=us-east-1b
Last updated 8 days ago.