This is your starting point for initializing your AWS infrastructure.
I recommend cloning all the repos needed for this example by running the following:
bash <(curl -s https://raw.githubusercontent.com/OGProgrammer/terraform-aws-init/master/clone-cd-example.sh)
- Terraform 0.9+
-
Log into the AWS console and create an IAM user for you to use in your CLI.
-
Create an IAM user with the AdministratorAccess policy attached so you can do all sorts of naughty things.
-
Get programmatic access via the key+secret which you will need in a minute. Download the credentials.csv for safe keeping.
-
Setup AWS CLI (I just used
brew install awscli
) -
Run
aws configure
and paste the key+secret you got earlier. No default region or output format needed. -
Install Terraform
-
Run
./tf-plan.sh us-west-2
to test it. You should seePlan: 6 to add, 0 to change, 0 to destroy.
and your ssh key being added. -
Run
./tf-apply.sh us-west-2
to deploy the base AWS resources you'll need for the rest of your infrastructure and services. -
Once terraform creates these things needed. Keep the
terraform.tfstate
&terraform.tfstate.backup
file in a safe place. This will be the only state file not stored in S3 since this is your base resources needed to store other terraform state files. -
You're all done! Congrats on nailing your first step to creating your infrastructure.
To destroy these resources, simply run the ./tf-destroy.sh us-west-2
script to destroy EVERYTHING. This includes your s3 buckets, state files, logs, etc.
If you plan on doing more than one region, clone this repo with the region suffixed. Ex. "terraform-aws-init-us-west-2"
Otherwise, your existing tfstate file will clash with the first region you provisioned.