Note: I take no responsibility for anyone executing this terraform
I've copied this from Kevin Vogel article series on Medium:
- Why You Should Use Terraform | by Kevin Vogel
- How To Create An EC2 Instance With Terraform | by Kevin Vogel
# init modules
$ terraform init
# validate configuration
$ terraform validate
# plan configuration
$ terraform plan
# apply configuration
$ terraform apply
# Change key permissions
chmod 400 ./key.pem
# Access your instance through ssh
ssh -i "key.pem" ubuntu@<YOUR_INSTANCE_PUBLIC_IP>
# Verify everything was installed properly
cat /var/log/cloud-init-output.log
# destroy configuration
$ terraform destroy