I have a Windows Elastic Beanstalk instance. I have the following commands.config
in my project's .ebextensions
commands:
00-install-choco:
command: |
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
01-set-choco-path:
command: |
SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
These two commands are working. However, I also have a container-commands.config
file which needs to call upon choco
, but it keeps failing due to 'choco' is not recognized as an internal or external command
container_commands:
01-install nssm:
command: |
choco install nssm -y
How do I get subsequent commands to pick up the updated PATH
? Is there a more appropriate approach to installing binaries and setting them to Window's PATH
during ESB instance creation?
I attempted to follow https://aws.amazon.com/blogs/developer/using-nuget-and-chocolatey-package-managers-in-aws-cloudformation-and-aws-elastic-beanstalk/
files:
c:/tools/ewmp.cmd:
content: |
@ECHO OFF
FOR /F "tokens=3,*" %%a IN ('REG QUERY "HKLMSystemCurrentControlSetControlSession ManagerEnvironment" /v PATH') DO PATH %%a%%b
%*
commands:
01-install-choco:
command: powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
waitAfterCompletion: 0
02-install-nssm:
command: c:/tools/ewmp choco install nssm -y
waitAfterCompletion: 0
But even that gives me similar errors.
-----------------------Command Output-----------------------
ERROR: Invalid key name.
Type "REG QUERY /?" for usage.
'choco' is not recognized as an internal or external command,
operable program or batch file.
------------------------------------------------------------