Autoscaling Groups With Terraform On AWS Part 1: Basic Steps
So you want to create an autoscaling group on AWS using terraform. See how to do it in this quick tutorial.
Join the DZone community and get the full member experience.Join For Free
So you want to create an autoscaling group on AWS using terraform. The following are the minimum steps in order to achieve so.
Before writing the actual code you shall specify the AWS Terraform provider as well as the region on the provider.tf file.
The next step would be to define some variables on the variables.tf file.
Then we are going to have the autoscalling group configuration on the autoscalling_group.tf file.
Let’s break them down.
The vpc id is needed in order to identify the subnets used by your autoscaling group.
Thus the value vpc_zone_identifier shall derive the subnets from the vpc defined.
Then you have to create a launch configuration.
The launch configuration shall specify the image id which is based on your region and the instance type.
To execute this provided you have your AWS credentials in place you have to do initialize and then apply
In the next tutorial, we shall focus on adding an instance security group and a boot script.
Published at DZone with permission of Emmanouil Gkatziouras, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.