0

Are there any bat scripts (for Windows Server) to handle Elastic Load Balancer when deploying through CodeDeploy? I've found only scripts for linux:

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

Unfortunately, they even don't mention in docs about Windows Server support:

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

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
piotrwest
  • 2,098
  • 23
  • 35
  • Of course I could use Cygwin to run those scripts, but that seems to be naughty workaround... – piotrwest Nov 06 '15 at 11:13
  • I am working on a port actually. Just wondering why you think Cygin would be 'naughty'? – Rodrigo Murillo Nov 06 '15 at 23:52
  • Finally, I got it working with Cygwin. However, I've also filed an issue for Amazon support - let's see what their's response will be. Solution with Cygwin doesn't seem to be right for me because what I'm trying to do is fairly simple, popular case and requiring additional software is ridiculous. Microsoft Azure deployment from git is much easier. – piotrwest Nov 07 '15 at 23:20

1 Answers1

0

The official answer from Amazon linked back to this topic and they said "someone" is using Cygwin and I should try it also...

Unfortunately, having no other possibility, I've installed Cygwin and in appspec.yml I've put:

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

In the deregister_from_elb.bat file, I run the .sh file with Cygwin, as follows:

@echo off

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

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

You can imagine how register_with_elb.bat looks like.

This solution works in production now, without any major problems for ~6 months.

piotrwest
  • 2,098
  • 23
  • 35