How to use Amazon AWS with Juju
This guide shows you how to manage workloads on Amazon AWS.
- Create an AWS user account
- Add credentials
- Create a controller
- AWS-specific features
- Next steps
Visit the AWS Management Console and log in.
Select My Security Credentials from the drop-down menu:
If you see a pop-up with the button “Get Started with IAM Users” go ahead and click on it and then “Add user”. If you do not see such a pop-up then, in the top bar, choose Services > IAM > Users > Add user:
Enter a name for your user and set Programmatic access as the AWS access type before clicking Next: Permissions to continue.
On the next page create a group which, by default, will contain your new user. Name the group and select one or many pre-existing policies that correspond to your requirements. The AmazonEC2FullAccess policy will be sufficient for most use cases.
Here we’ve chosen AdministratorAccess, which is the most privileged policy available. This could be useful if we wish to use the
juju trust to allow charms to provision any AWS service later on.
Click the Create group button and then Next: Tags. Tags are optional is skipped here by clicking Next: Review straight away. On the next page click Create user.
Successfully creating a new user results in a Success message appear:
Click on the Download .csv button to get a copy of this account’s security credentials. The contents of this file will look similar to this:
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 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.
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".
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 https://juju.is/docs/olm/credentials#heading--use-a-yaml-file for guidance on what such a file looks like.
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.
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.
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.
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.
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 6 days ago.