How to use Amazon AWS with Juju
This guide shows you how to manage workloads on Amazon AWS.
- Add cloud
- Add credentials
- Create a controller
- AWS-specific features
- Next steps
Juju already has knowledge of the AWS cloud, which means you don’t need to add it explicitly. You should be able to see it already when you run:
juju clouds --all
There are multiple methods for adding security credentials to Juju. Each process will require two fields from the CSV file that you downloaded from the AWS user account (Hyphens indicate that the field is unnecessary).
Alternately, you can use your credentials with Juju as a Service, where charms can be deployed within a graphical environment that comes equipped with a ready-made controller.
Use the interactive method
Credentials can be added with the
juju add-credential command:
juju add-credential aws
An example session:
Enter credential name: jlaurin Using auth-type "access-key". Enter access-key: AKIAIFII5EH5FOCYZJMA Enter secret-key: ****************************** Credential "jlaurin" added locally for cloud "aws".
Use a YAML file
A YAML-formatted file, say
mycreds.yaml, can be used to store credential information for any cloud. This information is then added to Juju by pointing the
add-credential command to the file:
juju add-credential aws -f mycreds.yaml
See How to add a credential > Use a YAML file for guidance on what such a file looks like.
Use environment variables
With AWS you have the option of adding credentials using the following environment variables that may already be present (and set) on your client system:
Add this credential information to Juju in this way:
For any found credentials you will be asked which ones to use and what name to store them under.
On Linux systems, files
$HOME/.aws/config may be used to define these variables and are parsed by the above command as part of the scanning process.
For background information on this method read section Adding credentials from environment variables.
Create a controller
You are now ready to create a Juju controller for cloud ‘aws’:
juju bootstrap aws aws-controller
Above, the name given to the new controller is ‘aws-controller’. AWS will provision an instance to run the controller on.
For a detailed explanation and examples of the
bootstrap command see the Creating a controller page.
Awareness of regions and instance types
Juju contains built-in knowledge of AWS regions, instance types and their capabilities.
juju show-cloud --local aws
--local option with
--controller to report regions known to a controller.
juju update-public-clouds to update Juju’s knowledge of new AWS regions as they are available.
Consistent naming, tagging, and the ability to add user-controlled tags to created instances. See Instance naming and tagging for more information.
Instance type selection
Juju’s default AWS instance type is m3.medium. A different type can be selected via a constraint:
juju add-machine --constraints 'instance-type=t2.medium'. For more information see Constraints. You can also view the list of Amazon EC2 instance types.
Support for Virtual Private Cloud (VPC) functionality
A controller can be placed in a specific virtual private cloud (VPC). See Passing a cloud-specific setting for instructions.
Important note for AWS accounts created before 2013-12-04: These accounts do not have a default VPC. Juju may select a much larger instance type than what is required. To remedy this, create a default VPC for your AWS account.
A controller is created with two models - the ‘controller’ model, which should be reserved for Juju’s internal operations, and a model named ‘default’, which can be used for deploying user workloads.
See these pages for ideas on what to do next:
Last updated 5 months ago.