0

通过 CodeDeploy 部署时,是否有任何 bat 脚本(适用于 Windows Server)来处理 Elastic Load Balancer?我只找到了适用于 linux 的脚本:

https://github.com/awslabs/aws-codedeploy-samples/tree/master/load-balancing/elb

不幸的是,他们甚至没有在有关 Windows Server 支持的文档中提及:

http://docs.aws.amazon.com/codedeploy/latest/userguide/elastic-load-balancing-integ.html

4

1 回答 1

0

亚马逊的官方回答链接到这个话题,他们说“有人”正在使用 Cygwin,我也应该尝试一下......

不幸的是,没有其他可能性,我已经安装了 Cygwin 并在appspec.yml中输入:

version: 0.0
os: windows
files:
  - source: \xxx\
    destination: C:\xxx\
hooks:
  ApplicationStop:
    - location: \deregister_from_elb.bat
      timeout: 900

<next steps here>

  ApplicationStart:
    - location: \register_with_elb.bat
      timeout: 900

deregister_from_elb.bat文件中,我用 Cygwin 运行.sh文件,如下:

@echo off

SET mypath=%~dp0
SET mypath=%mypath:~3%

C:\cygwin64\bin\bash.exe -l -c "'/cygdrive/c/%mypath%deregister_from_elb.sh'"

你可以想象register_with_elb.bat的样子。

该解决方案现在可以在生产中使用,大约 6 个月没有任何重大问题。

于 2016-07-13T07:39:26.210 回答