codedeploy blue-green deployment, Original Environment failed, the instance did not start


Edit deployment group Enter image description here Enter image description here

Auto Scaling groups Enter image description here Enter image description here Enter image description here

Deployment Enter image description here Enter image description here

The above is my configuration, and it can run successfully, but why does Original fail and does not automatically start related instances? Blue only has a machine with a load balancer mounted on it.

Problem Description:

In the AWS CodeDeploy blue-green deployment, during the third step, "Reroute traffic to replacement," the replacement instance is successfully deployed and registered to the target group. However, the original instance operation step, "BeforeBlockTraffic," fails, and the original instance never starts from the beginning to the end. Why does this happen?

Key Information:

The replacement instance is successfully deployed and registered to the target group. Failure occurs during the execution of the "BeforeBlockTraffic" step. The original instance never starts. What could be the possible reasons for the failure of the "BeforeBlockTraffic" step, and the original instance not starting?

Deployment process

Deployment lifecycle events

I verified the scripts related to the "BeforeBlockTraffic" lifecycle event to make sure they had no errors and that the scripts were executable and had the correct permissions.

I checked the health of the instances in the Auto Scaling group to make sure the original instance was healthy and able to handle the traffic.

I confirmed that the CodeDeploy agent was installed and running on my instance, looked at the agent logs, and found no errors.

I checked the deployment group configuration in the CodeDeploy console to make sure it had the Auto Scaling group and instance set up correctly.

I double-checked the Auto Scaling group's settings, including launch configuration and health checks, to make sure it was set up correctly to launch and terminate instances.

I confirmed the security group and network configuration to ensure they allow the necessary communication between instances.

Are there any other areas I can check to determine why the "BeforeBlockTraffic" hook is failing and find a solution? Are there any relevant logs or error messages that might provide more clues?

asked 6 months ago210 views
1 Answer

Check the health check configuration for your load balancer. Ensure that the health check settings are correctly configured to detect the instances' health. If the health checks fail, the instances might be marked as unhealthy, preventing them from being in service.systematically reviewing these aspects of your Blue-Green deployment configuration, logs, and associated AWS resources, you should be able to identify and address the issue causing the original environment instances to fail to start. If the problem persists, additional details from logs and AWS resource configurations may be necessary for further diagnosis.Kindly let me know what you found in the logs "/var/log/aws/codedeploy-agent/codedeploy-agent.log"

profile picture
answered 6 months ago
  • Why is the blue-green deployment Replacement instance enabled and configured successfully, but the Original instance is not enabled?

  • The log only has this information 2023-12-15T05:46:07 DEBUG [codedeploy-agent(1169)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PollHostCommand: 2023-12-15T05:46:07 INFO [codedeploy-agent(1169)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.6.0-49_deb.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions