Elastic Beanstalk unable to restart app servers since IIS 10.0 2.15.0

1

Our elastic beanstalk environments running Windows Server are unable to have their app servers restarted since the managed update:

Platform update from 64bit Windows Server 2016 running IIS 10.0 2.14.1 to 64bit Windows Server 2016 running IIS 10.0 2.15.0 https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2024-04-18-windows.html

This is affecting multiple environments.

EBS logs:

2024-04-26 08:49:50,551 [ERROR] Error encountered during build of Hook-PreRestartAppServer: Command hooks failed
Traceback (most recent call last):
  File "cfnbootstrap\construction.pyc", line 581, in run_config
  File "cfnbootstrap\construction.pyc", line 146, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 127, in apply
cfnbootstrap.construction_errors.ToolError: Command hooks failed
2024-04-26 08:49:50,551 [ERROR] -----------------------BUILD FAILED!------------------------
2024-04-26 08:49:50,551 [ERROR] Unhandled exception during build: Command hooks failed
Traceback (most recent call last):
  File "cfn-init", line 181, in <module>
  File "cfnbootstrap\construction.pyc", line 137, in build
  File "cfnbootstrap\construction.pyc", line 567, in build
  File "cfnbootstrap\construction.pyc", line 581, in run_config
  File "cfnbootstrap\construction.pyc", line 146, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 127, in apply
cfnbootstrap.construction_errors.ToolError: Command hooks failed

EBS console logs

Tests done:

  • Rebooting the instances from EC2 works
  • Confirmed fault with:
    • 2 environments using IIS 10.0 running on 64bit Windows Server 2016/2.15.0
    • 1 environment (different application) using IIS 10.0 running on 64bit Windows Server 2019/2.15.0
  • Running into something similar here with IIS 10.0 running on 64bit Windows Server 2019/2.15.0. App refuses to run properly on this platform version. Our instances just become unhealthy and our codepipelines aren't able to work. We constantly get "Invalid application version" errors on this platform version. Tested with 2.13.2 and everything works, same with 2.14. Went into the instance via session manager and ASPNETCOREWEBAPP directory is nonexistent, not sure if that's having a play in it. Are you facing this issue still?

  • @nb we're still facing the same issue yes - not as bad as yours though!

CraigL
asked 11 days ago190 views
1 Answer
1

Hi CraigL,

The restart application server hook is failing in Windows Server platform version 2.15.0 due to some missing directories, namely the C:\Program Files\Amazon\ElasticBeanstalk\hooks\restartappserver\pre and C:\Program Files\Amazon\ElasticBeanstalk\hooks\restartappserver\post directories. A temporary workaround to this issue is to use ebextensions [1] to create those missing directories. Here is an example below:

.ebextensions/fix_restart_app_server.config

files:
 "C:\\restartappserver\\fix_restart_app_server.ps1":
   content: |
    mkdir "C:\Program Files\Amazon\ElasticBeanstalk\hooks\restartappserver\pre" -ea 0
    mkdir "C:\Program Files\Amazon\ElasticBeanstalk\hooks\restartappserver\post" -ea 0
   
commands:
  00_create_missing_directories:
    command: powershell -command "& \"C:\\restartappserver\\fix_restart_app_server.ps1\""
    waitAfterCompletion: 0
  01_cleanup:
    command: powershell -command "Remove-Item \"C:\\restartappserver\" -Force -Recurse"
    waitAfterCompletion: 0

The .ebextensions folder will need to be placed in the root directory of your application source bundle before deploying to the Windows Server environment.

[1] https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html#windows-files

Naim S
answered 6 days ago

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