In this section we show you how to use the aws terraform module to setup your own infrastructure on Amazon AWS provider.
You can use our aws template to create a repository. Click on the
Use this template link on the repo.
Name the module and simply clone the repository down.
Let’s begin by cloning our repository we created using the template.
git clone [email protected]:<your-organization>/<your-repo>.git
Once you’ve cloned down the repository simply replace the
cluster_name with the desired name for your cluster. You can also update the
node_size and the
size parameter in the
cluster_topology based on the value you wish to use from aws ec2 instance sizes.
Once you’ve updated the values create a
.auto.tfvars and add your tokens.
aws_access_key = <your aws access key> aws_secret_key = <your aws secret key> instellar_auth_token = <your instellar auth token>
You can get the
instellar_auth_token by signing up and heading over to the
Credentials page on instellar.
This section assumes you already know how to generate the ssh-key. If you don’t know how to do this I recommend this post. To add the ssh-key to Amazon AWS. Head to the EC2 Dashboard and look for the
Key Pairs link.
Import key pair button.
You can import the key pair by copying your public key and paste it in the box.
Once you’ve added your public key you can copy the name and use it in your
AWS Access and Secret Key
Let’s look at how we can retrieve the Access Key and Secret Key to be used with the terraform module.
Head over to the IAM section
Add users button.
Give the user a name and simply click
You’ll need to attach the
AdministratorAccess role to the user, and click
Review all the details and once you’re ready click
Once you created the user go to the user detail, and click on the
Security credentials page.
Access keys section and click
Create access key
Other and click
Set description for your access key
Finally you can retrieve your access key.
The access key should never be checked into your code repository. This is for running locally or using in terraform cloud only. If running locally you can put these values in
Running Locally via CLI
aws_secret_key variable should not be checked into your code repository.
.auto.tfvars in your working directory. This file should not be checked into your code repository.
aws_access_key = "<aws-access-key>" aws_secret_key = "<aws-secret-key>"
If you use the template above the
.auto.tfvars is automatically ignored.
Once all the configuration files are in place simply run:
terraform init terraform plan terraform apply