AWS Elasticbeanstalk ebextensions server restart error “Error occurred during build: [Errno 4] Interrupted function call”

Question:

I’ve got a elasticbeanstalk environment that needs to run a powershell script and restart before the application is deployed. According to the documentation this is supported as per the documentation

If the system requires a reboot after the command completes, the system reboots after the specified number of seconds elapses. If the system reboots as a result of a command, Elastic Beanstalk will recover to the point after the command in the configuration file. The default value is 60 seconds. You can also specify forever, but the system must reboot before you can run another command.

However when I add a reboot command to a ebextensions .config file I get the following exception from elasticbeanstalk

The logs on the server after it has rebooted show that the command was executed so I assume the error is caused by a restart during the app deploy stage.

If I remove the restart command, deploy, wait for it to be ready then trigger a restart manually it works fine. But this is obviously not acceptable.

I’ve looked into the deployment hooks file system approach but that doesn’t work either, and seems unessesary given it sounds like it should support this requirement out of the box.

Does anybody have any ideas?

Answer:

We’ve had the same issue. We needed to disable SSL and TLS < 1.2, which requires registry changes and a reboot. Our workaround is to do the reboot in the container_commands section with a wait of forever. This seems to properly reboot and then trigger success in the deployment. However, it never actually does any of the steps after the reboot, which includes the built-in deployment of the code from the staging location to the actual final file destination (inetpub/wwwroot most likely). To get around this, have a step just before the reboot to copy the files from the local staging directory to the web root yourself.

Source:

AWS Elasticbeanstalk ebextensions server restart error “Error occurred during build: [Errno 4] Interrupted function call” by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply