aws-codedeploy-agent: Rebooting the instance during deployment causes an error

Trying to reboot the instance the instance during deployment causes an error:

Script - scripts/reboot.sh
[stderr]+ reboot
[stderr]
[stderr]Session terminated, terminating shell... ...terminated.

It’d be nice to have a way to tell the CodeDeploy that the instance is going to reboot and it has to wait for it to come up, or is there already a method for doing that?

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

@tomyam1 adding it as a feature request for now .

IIS website will mount FSx as a virtual directory FSx needs Active Directory. Active Directory needs a reboot.

Again I’m asking why can’t the deb packaging honour policy-rc.d - this is unrelated to rebooting the instance with a running agent, just that installing the agent doesn’t automatically start it. As it stands this morning there are updates published that require a restart but there is no updated AMI yet:

image

This means that until a new AMI is published, scaling or refreshing instances has a high probability of failure if we try to reboot them after the cloud-init process is complete as it’s a race between stopping the agent after it’s automatically started and the agent triggering the deploy. The only alternative is to not reboot them after the cloud-init process is complete and then manually reboot them once the deploy is complete.

I’m really at a loss to understand why a tiny change can’t be made to the deb packaging to honour the conventions - can you please enlighten me? 🙏🏻

My use case : Windows/IIS environment requires IIS, AD, CodeDeploy, CloudWatch, and various other security/monitoring agents to be installed and configured on boot - requiring either one or two reboots (I know, windows ◔_◔ ). When our ASG scales up, the deployment begins as soon as the agent registers itself, which may be before AD registration is complete. In this case, deployments fail with no output and no error message - just the step they were at when the reboot happened.
If it’s too hard to continue the deployment after a reboot, another option would be to add a message like “codedeploy agent did not respond” so that it’s clear the problem was with agent/instance rather than the appspec_ script.