There was a new release of Juju this week, 1.11.3, that brought a “small feature” with a big impact on your AWS bill. You are now able to deploy multiple services on one cloud server instantly. Before Juju started a new server per service which resulted in a potentially high AWS bill.
If you want to use the new feature you need to work with the development version of Juju Core. To install Juju on AWS just copy the below code into a file, e.g. installjuju.sh, make it executable: chmod u+x installjuju.sh and execute it: ./installjuju.sh
echo "Installing Juju. Asks for your password."
sudo add-apt-repository ppa:juju/devel -y
sudo apt-get update -y
sudo apt-get install juju-core -y
if [ ! -f ~/.ssh/id_rsa ]; then
echo "Generating SSH Keys."
ssh-keygen -t rsa -b 2048
if [ ! -f ~/.juju/environments.yaml ]; then
echo "Generating environments.yaml."
juju generate-config -w
echo "Your AWS Access Key, followed by [Enter]:"
echo "Your AWS Secret Key, followed by [Enter]:"
sed -i -e "s/# access-key: /access-key: $awsaccesskey/" ~/.juju/environments.yaml
sed -i -e "s/# secret-key: /secret-key: $awssecretkey/" ~/.juju/environments.yaml
echo "Bootstrapping Juju."
Afterwards you can start deploying services. If you want them to run on the same server you need to know the number of the server. Juju status will tell you this:
The bootstrap server is 0. New machines will be starting with 1 and go up. So if we want to install wordpress then we need to do the following:
juju deploy mysql --to 0 # deploy mysql to machine 0
juju deploy wordpress --to 0 # deploy wordpress to machine 0
juju add-relation mysql wordpress # create wordpress tables
juju expose wordpress # make wordpress accessible.
juju status # get the IP/URL of wordpress
Now you can log into WordPress. Your URL should look something like this:
When you are done: