2015-06-08 01:28:46 +02:00
# ASG example
This example shows how to launch instances using Auto Scaling Groups.
2015-07-12 19:59:50 +02:00
This creates a security group, launch configuration, auto scaling group and an ELB. The user data for launch configuration installs nginx and it listens on port 80.
2015-06-08 01:28:46 +02:00
2017-02-20 13:43:49 +01:00
The example uses latest Ubuntu AMIs.
2015-06-08 01:28:46 +02:00
Make sure you change the list of availability zones that is applicable to your account and region.
To run, configure your AWS provider as described in https://www.terraform.io/docs/providers/aws/index.html
Running the example
For planning phase
2017-02-20 13:43:49 +01:00
```
terraform plan -var 'key_name={your_key_name}'
```
2015-06-08 01:28:46 +02:00
2017-02-20 13:43:49 +01:00
For apply phase
2015-06-08 01:28:46 +02:00
2017-02-20 13:43:49 +01:00
```
terraform apply -var 'key_name={your_key_name}'
```
Once the stack is created, wait for few minutes and test the stack by launching a browser with ELB url.
2015-06-08 01:28:46 +02:00
To remove the stack
2017-02-20 13:43:49 +01:00
```
terraform destroy -var 'key_name={your_key_name}'
```