snippetterraformMinor
AWS launch template create-before-destory?
Viewed 0 times
templatebeforecreatedestoryawslaunch
Problem
In terraform, to reduce downtime when creating a new auto-scaling-group behind an existing load balancer, you can use a launch configuration and set create-before-destroy.
Launch templates are the recommended/new replacement for launch configs... but I can't seem to figure out how to achieve the same thing.
How can you mimmic this behavior in launch templates?
Launch templates are the recommended/new replacement for launch configs... but I can't seem to figure out how to achieve the same thing.
How can you mimmic this behavior in launch templates?
Solution
It seems you're misunderstanding what the create-before-destroy lifecycle parameter of the launch configuration does.
It's about replacing the launch configuration within an autoscaling group, not replacing the autoscaling group.
Launch templates have versions which makes this parameter useless as you'll create a new version of the launch template before updating the ASG to use it.
Terraform gives an example in the ASG documentation.
The underlying idea is to be able to roll back more easily than with launch-configurations.
It's about replacing the launch configuration within an autoscaling group, not replacing the autoscaling group.
Launch templates have versions which makes this parameter useless as you'll create a new version of the launch template before updating the ASG to use it.
Terraform gives an example in the ASG documentation.
The underlying idea is to be able to roll back more easily than with launch-configurations.
Context
StackExchange DevOps Q#10855, answer score: 4
Revisions (0)
No revisions yet.