Need a different architecture? Ask Juju for it!

A colleague asked me about getting a cloud image for i386 (32 bit) architecture. Most modern hardware is 64 bit architecture, so getting a cloud image for the 32 bit architecture was not something I thought about for a while.

Summary: juju bootstrap -e amazon --constraints arch=i386 sets the environment constraint so all machines in this environment will be created with i386 architecture.

Machine constraints allow you to choose the virtual hardware that your services will be deployed. Using different architectures is as easy as adding a value to the bootstrap or deploy commands. This only works if your cloud provider has access to the architecture specific image like the Amazon cloud has access to the i386 images. Not all cloud providers have access to the different architecture images.

You can check to see what machine constraints your cloud provider supports by the command:

juju ensure-availability --constraints arch=i386

Constraints can be set for the whole Juju environment or individual services.

Environment constraints

Juju environment constraints can be set with the --constraints option on the juju bootstrap and the juju add-machine commands or by the juju set-constraints command. Environment constraints will be applied to the Juju environment as long as it is active.

$ juju bootstrap -e amazon --constraints "arch=i386 cpu-power=0 mem=512"

$ juju add-machine --constraints arch=amd64

$ juju set-constraints arch=i386

Service constraints

Service constraints can be set with the --constraints option on juju deploy command or by using the optional --service option on the juju set-constraints command. The constraint will only be applied to the machine created for that service.

$ juju deploy tomcat --constraints "arch=i386"

$ juju set-constraints arch=amd64 --service tomcat 

All future deployments of the "tomcat" service will be with the last constraint issued on the command line.

More information

Read more about the types of constraints available in Juju go here:

Read more about setting constraints here:

If you run into any problems or questions about constraints or anything Juju please reach out to us in #juju on Freenode, or at