How to set constraints for a model

Contents:

Set constraints for the initial controller and default models

Constraints can be applied to every machine (controller and non-controller) in the ‘controller’ and ‘default’ models. This is done, again, during the controller-creation process, but by using the --constraints option instead:

juju bootstrap --constraints mem=4G aws

See Creating a controller for more guidance.

Individual constraints from --bootstrap-constraints override any identical constraints from --constraints if these options are used in combination.

For the LXD cloud, the following invocation will place a limit of 2GiB of memory for each machine:

juju bootstrap --constraints mem=2G localhost

Set and display constraints for a model

See also: juju set-model-constraints, juju model-constraints

A model’s constraints – which will also affect any subsequent machines in that model – are set with the set-model-constraints command:

juju set-model-constraints mem=4G

For the LXD cloud, all new machines in the current model will be limited to an instance type of ‘c5.large’ (2 CPU and 4 GiB):

juju set-model-constraints instance-type=c5.xlarge

A model’s constraints are displayed with the model-constraints command:

juju model-constraints

A model’s constraints can be reset by using the set-model-constraints command with the value part empty :

juju set-model-constraints mem=

Last updated a month ago.