Clouds, controllers and models - first steps with Juju in Azure

In the previous post we created an environment in Azure using Juju, which is ready to be modeled. We're really close to make it work, but before we make another step, I'd like to make sure you're familiar with some basic terms, what should help you in the next episodes. Let's get started!


As I said previously, Juju comes with a seamless support regarding all major clouds like AWS, Google Cloud or Azure. It's also possible to use it with e.g. private clouds like OpenStack - the possibilities are unlimited. When we're talking about a 'cloud' here, we're thinking about a whole environment managed by Juju's controllers.

To make things even cooler, Juju gives you a possibility to select a region where you'd like to get started. Of course it has some predefined settings, but you're not forced to choose "the-one-and-the-only" region. What is more, both available clouds and regions are not hardcoded - it's possible to fetch updated data when needed.


When you've chosen your environment, you need something for controlling it. That's the purpose of controllers - nodes in your infrastructure, which are responsible for managing it. The important thing is, that a controller is a machine itself - it's both an element of Juju's structure and a computer, which needs resources. No matter how many machines you spawn later, a controller will always be your machine-0.

A schema of a basic structure used in Juju


Models are virtual environments attached to a controller. By default a controller has two models - admin and default. In fact 'admin' model is designed for some internal stuff and shouldn't be used. 

A simple model of a Wordpress instance and a MySQL database on two machines

What is more, models and controllers can be switched anytime. You can have multiple configurations prepared and easily switch between them when needed. The best thing is that models can be constrained - this is a complex topic however and we'll cover it in the future posts.


In this short blog post we learned the most basic terms in Juju. We know what are the main parts of our system and we're aware of their connections. In the next post we'll dig deeper into different components and try to prepare a simple model, which we'll try to reuse. 


I'm charmed - modeling a cloud with Juju

Modeling a cloud solution in Azure can be described as well... lacking. Don't get me wrong - we have ARM with recently updated reference(it really helps when it comes to create a custom template with many not-so-popular resources), but it is limited to components available to it. What if I want to deploy something created as a Docker container? Or use configuration prepared with Chef or Puppet? Well, it's still possible to incorporate all above into your process of delivering software, but it easily becomes a total mess. I'd like to introduce a tool to you, which could help in scenarios, where simple ARM templates and VSTS hit their limits.

What is all about?

Juju is a tool, which can help you in modeling how your infrastructure should look like and how it is connected. While Chef or Puppet help you prepare, manage and run multiple complex configurations related to all components used for your software, Juju works in a layer above - it excels in combining all scripts, containers and components into easy to understand model, which can be parameterized and reused. 

What is more, it is fully integrated with many different clouds - you can use it with AWS, Google Cloud, Azure or even create your local cloud using LXD. Its capabilities are quite impressive.

I want it!

To get started I strongly recommend you to read how to install and use Juju. Only thing you need is at least Ubuntu 16.04 LTS which you can easily obtain from the marketplace in Azure Portal. You can also use your local machine with Ubuntu installed on it - it's purpose is to have a central controller, which can be used to control our infrastructure.

When you reach Create a controller section, I'd like you to stop for a moment. In fact we don't want to focus on using Juju with LXD - I'd like to go straight to Azure bootstrap since this is what it's all about!

To configure Juju to work with your Azure subscription you will need a subscription identifier. Please go through this tutorial, which should help you add credentials to your account. When you have credentials added, just go to the terminal and enter:

kamz@blog-ubuntu:~$ juju bootstrap azure mycloud

This will take several minutes to actually configure whole bootstrap and your new environment.

The result of running a bootstrap command

Once bootstrap has completed, you can run another command:

juju gui

it will return a URL where you can access Juju and credentials to be used to sign in. Note that using GUI is optional - you can perform all tasks using CLI only. 

Juju dashboard after a bootstrap has been initialized


In this post I introduced application modeling term and presented the easiest way to get started with Juju. In the next post we'll try to get even more knowledge about other parts of it like charms and bundles and what we can do with them.