0

hoping for some idea how to fix this!

I've got an .NET web application running in Elastic Beanstalk, which needed a couple of things done to it through ebextensions. It works consistently after an instance is created, but on instance creation, there seems to be a problem.

In the log files, there is the following:

2015-03-12 15:44:36,901 [INFO] Running config postbuild_0_MyConfig
2015-03-12 15:44:38,309 [ERROR] -----------------------BUILD FAILED!------------------------
2015-03-12 15:44:38,309 [ERROR] Unhandled exception during build: [Error 267] The directory name is invalid
Traceback (most recent call last):
  File "cfn-init", line 123, in <module>
  File "cfnbootstrap\construction.pyc", line 117, in build
  File "cfnbootstrap\construction.pyc", line 502, in build
  File "cfnbootstrap\construction.pyc", line 513, in run_config
  File "cfnbootstrap\construction.pyc", line 125, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 104, in apply
  File "cfnbootstrap\util.pyc", line 468, in call
  File "cfnbootstrap\util.pyc", line 454, in call
  File "subprocess.pyc", line 679, in __init__
  File "subprocess.pyc", line 896, in _execute_child
WindowsError: [Error 267] The directory name is invalid

Following that failing, I will run the deploy again with the same code version from the AWS Console, and I get:

2015-03-12 16:00:42,526 [INFO] Running config postbuild_0_Umbraco
2015-03-12 16:00:44,558 [INFO] Command 01-changeperm succeeded
2015-03-12 16:00:44,558 [INFO] Waiting 60 seconds for reboot
2015-03-12 16:01:47,322 [INFO] Command 02-createvirtualdirectory succeeded
2015-03-12 16:01:47,338 [INFO] Waiting 60 seconds for reboot

Which is as expected.

I believe it must be failing due to the config file itself, as problems with the inividual commands themselves result in a different error.

Here is my .config file which is deployed into the .ebextensions folder, along with the referenced scripts:

container_commands:
  01-changeperm:
    command: "permissions.bat > ../eblog.log"
    cwd: "C:/inetpub/wwwroot/.ebextensions"
  02-createvirtualdirectory:
    command: "powershell.exe -noprofile -executionpolicy bypass -file ./virtualdir.ps1 > ../vd.log"
    cwd: "C:/inetpub/wwwroot/.ebextensions"

Hope someone can help me with this, as I'm at a loss! If anyone wants more information, just ask!

Thanks in advance.

1 Answer 1

3

The execution of the configs is slightly different on Windows because of the way webdeploy packages are deployed.

For this reason, you cannot count on any of the files in your .ebextensions folder (or anything in your bundle) existing on disk (that's not where the scripts are actually executed from).

The commands in your .ebextensions configs get executed before any of your bits are laid down on disk (even container_commands).

For that reason, you may need to inline your bat file and ps1 script, or put them in S3, then lay them down with file: directives.

2
  • Hi thanks for this. If I download a file from s3 as part of the files section, will it then be accessible from the container commands section? Once I get the file, it's not clear from the amazon docs how to run it. Mar 13, 2015 at 9:32
  • Got this working now. Yes, container_commands runs fine on files generated by the files directive. Thanks for your help. Mar 13, 2015 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.