- Terraform provisions an EC2 auto scaling group.
- Chef configures a basic apache web server.
- Clone this repository locally.
- Ensure your AWS API access keys are defined in
~/.aws/credentials
. - Update
terraform/terraform.tfvars
variables with your AWS account ID and other optional parameters. - Use Terraform to provision infrastructure.
$ cd terraform/
$ terraform apply -target=module.vpc
$ terraform apply -target=module.apache
- SSH into server and run ChefSpec tests.
$ ssh ubuntu@<ec2_dns>
$ cd /srv/playground/chef/apache
$ sudo chef exec rspec
- Stress the CPU, which triggers ASG to spin up 2nd server.
$ stress -c 8
- Afterwards, use Terraform to destroy infrastructure.
$ terraform destroy -target=module.apache
$ terraform destroy -target=module.vpc