|
1 | 1 | # Automating AWS with Terraform
|
2 | 2 |
|
| 3 | +- [x] [Launch an ec2 instance](/launch-ec2-instance) |
| 4 | +- [X] [Create an s3 bucket](/create-s3-bucket) |
| 5 | +- [x] [Create an s3 backend state](/create-s3-backend-state) |
| 6 | +- [X] [Create an IAM group and policy](/create-iam-group-policy) |
| 7 | +- [x] [Add users to an IAM group](/add-users-to-iam-group) |
| 8 | + |
| 9 | +## External Resources |
| 10 | + [Amazon EC2 AMI Locator](https://cloud-images.ubuntu.com/locator/ec2/) |
| 11 | + |
3 | 12 | ## Pre-requisite Setup
|
4 | 13 |
|
5 | 14 | #### AWS Account - Free Tier
|
|
28 | 37 | 3. linux: [instructions](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html)
|
29 | 38 |
|
30 | 39 | #### AWS CLI configuration
|
31 |
| - 1. aws basic configuration |
| 40 | + aws credentials configured locally |
| 41 | + these credentials are stored in `~/.aws/credentials` |
32 | 42 | ```
|
33 | 43 | aws configure
|
34 | 44 | AWS Access Key ID [None]: <access key>
|
|
41 | 51 | #### Terraform installation
|
42 | 52 | 1. mac: `brew install terraform` | `terraform -help`
|
43 | 53 | 2. windows: `choco install terraform` | `terraform -help`
|
44 |
| - 3. linux: [download](https://www.terraform.io/downloads.html) | `echo $PATH` | ` mv ~/Downloads/terraform /usr/local/bin/` | `terraform -help` |
| 54 | + 3. linux: [download](https://www.terraform.io/downloads.html) | `echo $PATH` | ` mv ~/Downloads/terraform /usr/local/bin/` | `terraform -help` |
| 55 | + |
| 56 | + |
| 57 | +## Local Setup |
| 58 | + |
| 59 | +clone the repo and navigate to the directory |
| 60 | +``` |
| 61 | +git clone https://github.com/ari-hacks/terraform-aws-automation.git |
| 62 | +cd terraform-aws-automation |
| 63 | +``` |
| 64 | + |
| 65 | +In the terminal `cd` into one of the directories from the list above |
| 66 | + |
| 67 | +Run these commands to provision with Terraform |
| 68 | + |
| 69 | +```HCL |
| 70 | +#Initialize Terraform |
| 71 | +terraform init |
| 72 | +``` |
| 73 | + |
| 74 | +```HCL |
| 75 | +#Check the plan to make sure the configuration will do what we expect it to do |
| 76 | +terraform plan |
| 77 | +``` |
| 78 | + |
| 79 | +```HCL |
| 80 | +#Check the plan to make sure the configuration will do what we expect it to do |
| 81 | +terraform apply |
| 82 | +``` |
| 83 | + |
| 84 | +```HCL |
| 85 | +#Check the resource is up |
| 86 | +terraform stat show 'type.name' |
| 87 | +``` |
| 88 | + |
| 89 | +```HCL |
| 90 | +#Tear down all provisions |
| 91 | +terraform destroy |
| 92 | +``` |
| 93 | + |
0 commit comments