Question: We are doing ASGs in Terraform, When we create a new launch config, we want the old instances using the old launch config to terminate, and spin up new instances with the new launch config, at the moment. I have to manually terminate the instances, then they get span up with the new one, anyone have any ideas how to automate this?

Asked By
ghardy
Asked At
2018-05-04 08:16:49

Found 15 possible answers.

User Answered At Possible Answer
rajesh.circuitmoon 2018-05-04 09:31:59 I have a EC2 server in ASG with at-least 1 EC2 instance in Desired instance. Any help would be appreciated.
Launching a new EC2 instance. Status Reason: Volume of size 8GB is smaller than snapshot 'snap-xxxxxxxxxxxxx', expect size >= 10GB. Launching EC2 instance failed.
But for some reason, ASG fails to start the new ec2 instance upon termination.
acsrujan 2018-05-04 09:51:48 With the info you gave, possible cause: Your launch config says 8gb as root volume while AMI expects 10gb..
rajesh.circuitmoon 2018-05-04 10:02:00 Yes @acsrujan. You were right. I modified my ASG config to use 10GB root volume and it worked. This was the AMI i was using - amzn2-ami-hvm-2017.12.0.20180328.1-x86_64-gp2-SQL_2017_Web-2018.04.10 Do you know where i find the releases notes for ami's ? What I am skeptical about is, same ASG worked last week with 8GB root volume space.
acsrujan 2018-05-04 10:09:57 AMI release notes and versions shouldn’t impact your ASG.. it
rajesh.circuitmoon 2018-05-04 10:17:32 I was wondering if the new version of ami needed atleast 10GB of root volume compared to previous 8GB. Hence, I was interested in release notes. We have a dynamic config for AMI ID in ASG - change in AMI ID wouldn't affect us.
fr33styl3ra 2018-05-04 10:29:25 @fr33styl3ra uploaded a file: Untitled https://devopschat.slack.com/files/U90GFARR6/FAJEU6R8D/-.pl and commented: This are y rules from the security group. I was trying to open internet from private ec2 instance to the internet so i want to have internet access for downloading the repo for example for example i want to use this private instance for git, jenkins etc
ghardy 2018-05-04 10:30:34 you need to have a NAT Gateway
SLACK 2018-05-04 11:53:13 @florian.desneux commented on @fr33styl3ra ’s file Untitled https://devopschat.slack.com/files/U90GFARR6/FAJEU6R8D/-.pl : You have to use a EIP (which would make your server public) but change your security group Or you could run a VPN Server
mohamadharissa2016 2018-05-04 13:47:49 https://youtu.be/g3a-Zr4bko4 please subscribe watch it if you are a programmer
dan512 2018-05-04 14:38:37 @lrpdata @wwsean08 thanks for your input. Yes, I have usually done the approach you describe. From my understanding, if you separate the data from the more "ephemeral" elements (ie EC2 instances), you can basically spin-up / tear down VPCs and just peer them to the the data VPC
lrpdata 2018-05-04 14:55:52 @dtirer do you guys have access to any Aws technical account managers ? Perhaps they could advise. I’m only getting this from blogs and demos . What you’re saying totally makes sense but is basically yet another layer Over top of security groups , nacl’s , subnets and probably IAM that you gotta worry about. If ephemeral is what you’re after, vpc doesn’t logically separate it any more than .. subnets? And then now you may have to worry about introducing IP space collision with diff vpc’s
grahamhar 2018-05-04 15:36:44 use the change of launchconfig event from cloudtrail, get it to trigger a lambda which doubles size of the associated ASG, waits for nodes to be healthy then scales back in. You need to set correct termination policy to ensure oldest instances are retired [May 4th, 2018 9:16 AM] ghardy: We are doing ASGs in Terraform, When we create a new launch config, we want the old instances using the old launch config to terminate, and spin up new instances with the new launch config, at the moment. I have to manually terminate the instances, then they get span up with the new one, anyone have any ideas how to automate this?
rlister 2018-05-04 15:39:35 @ghardy Cloudformation will take of this for you automatically given an appropriate UpdatePolicy : I would look to see if TF supports something similar.
cundo 2018-05-04 15:43:31 One approach I’ve taken is to version an ASG/LC tag. If the tag value changes, terraform brings up a new stack and destroys the existing if the new one is healthy.
dan512 2018-05-04 15:59:52 @lrpdata yeah that collisions are a good point.

Related Questions