Swap URL of two environments
Because AWS Elastic Beanstalk performs an in-place update when you update your application versions, your application might become unavailable to users for a short period of time. To avoid this, perform a blue/green deployment. To do this, deploy the new version to a separate environment, and then swap the CNAMEs of the two environments to redirect traffic to the new version instantly.
In this section, we will only focus on how to swap the URL between two environments (DEV and PROD).
- Go to Environment of Elastic Beanstalk.
- Select FCJ-My-First-App-env-DEV environment, click Action and choose Swap environment domain.

- At Environment, choose FCJ-My-First-App-env-PROD. Then, click Swap.

- After that, access to domain of FCJ-My-First-App-env-DEV and FCJ-My-First-App-env-PROD environment to see the result.
- The background of FCJ-My-First-App-env-DEV environment now is Green and the URL is FCJ-My-First-App-env-PROD.xxx.ap-southeast-1.elasticbeanstalk.com.
- The background of FCJ-My-First-App-env-PROD environment now is Blue and the URL is FCJ-My-First-App-env-DEV.xxx.ap-southeast-1.elasticbeanstalk.com.
So, two URLs of two environments are swapped each other.
