Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you rename an Elastic Beanstalk environment?

I started to use the Swap Environment URLs feature in Elastic Beanstalk (CNAME swap). What is the best approach, if I want to stick to the same environment name?

Currently, I swap twice. First I bring up my changed my-env-new environment. I perform the first cname swap from my-env to my-env-new. Then I delete the previous my-env. I clone the new my-env-new into my-env and swap again. Is there a better way?

I run an AWS external CI/CD pipeline, which uses the environment name to update the environment, hence I need to retain that name. Maybe it's not a best practice to hardcode the environment name in such a pipeline.

like image 989
reikje Avatar asked Oct 22 '25 18:10

reikje


1 Answers

Yes, this is pretty much how you do blue/green deployment using EB. The cloning is an integral part of it:

Lambda functions to clone the blue environment as the green environment, to re-swap the URLs, and to terminate the green environment when deployment and testing for the blue environment are complete.

The exact details how to do it in an automated manner are described in AWS whitepaper:

  • Blue-Green Deployments to AWS Elastic Beanstalk on the AWS Cloud - Using AWS CodePipeline for Deploying to AWS Elastic Beanstalk Environments

Regarding the hard-coding of the env name, I'm not sure from your question where is it being hard-coded? If you use CloudFormatin for your pipeline, you can pass it as a default parameter to it. This way it is easy to change and re-use your pipeline. If you created pipeline in AWS console, then selection of existing EB application and EB environment are necessary in a deploy stage.

like image 51
Marcin Avatar answered Oct 24 '25 08:10

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!