Rebuild Elastic Beanstalk environment without losing ElasticIP
Asked Answered
S

2

7

I created an Elastic Beanstalk environment with a VPC. Sometimes the environment will lock up on a code version deploy and have to be rebuilt. When this happens I lose my Elastic IP.

I tried disassociating the EIP before the rebuild, but it is still replaced. What can I do to make the EIP permanent!? (Yes, I need an EIP and a CNAME is not sufficient for my purposes)

Stopover answered 10/11, 2015 at 4:53 Comment(7)
By "on a deploy", I assume you mean you're spinning up a new EC2 instance as a result of a new Beanstalk environment? Or are you simply trying to redeploy to an existing instance? If you can be more specific as to what you're doing, that might help.Glutamine
I mean a deploy of new code, or a new application version, to an existing instance. I have quite a few different EB environments among many projects, and it is not terribly uncommon for deploys to crash, and the env to require a rebuild.Stopover
The only thing I can think of is to try and use EB's hooks into autoscaling to detect when the instance has failed and automatically spin up a new instance with the EB deployment and re-map the EIP from the first instance to the second. This should be capable of being automated.Glutamine
This is a single instance environment. When it locks up nothing responds in the AWS console. Eventually it will get stuck in a red severe state and you can initiate a rebuild. It seems to me like it should just get rebuilt underneath the existing IP, but just like security groups, and everything else, the EIP gets deleted.Stopover
Tony, I honestly would go to AWS with that. Post it to the forum or something. But have you tried setting some auto scale parameters?Glutamine
@TonyGutierrez, Did you have any luck with this? I'm having the same issue.Marivaux
@TonyGutierrez I have the same issue too. Finding solution for it...Banquer
E
0

Replace Root Volume

You can use the "Replace root volume" feature (available since Apr/2021).

From the CLI:

aws ec2 create-replace-root-volume-task --instance-id INSTANCEID

From the Console:

EC2 > Right click on instance > Monitor and troubleshoot > Replace root volume

Leave the snapshot ID blank.

Excrescency answered 6/5, 2021 at 9:7 Comment(0)
V
0

If you spin up a elastic beanstalk environment in an VPC's subnet with an NAT gateway which already exists. I believe if Elastic beanstalk did not configure your EIP it should not automatically release it. Just saying that I have never experienced this issue you are raising here; My deployments never result in random crashes. You should check out why this happens and resolve that aswell.

I think this is maybe the difference between you and my setup: I configured elastic beanstalk in an already created VPC. I used this guide to create my VPC and subnets; maybe this is helpful for you too:

https://spinupwp.com/scaling-laravel-using-aws-elastic-beanstalk-part-2-setting-up-vpc-rds-elasticache/

What you can also do is a Green/Blue deployment on major software releases. You create a new EB environment you can copy the configuration of your current environment or with help of .ebextensions and hooks predeploy/postdeploy configure your environment for you. This will help you test/wait until the new deployment is stable and switch the DNS of your EB environments: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.CNAMESwap.html

Venom answered 6/5, 2021 at 12:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.