3

I am fairly new to Amazon Cloud Auto Scaling (and AWS all together).

I am currently trying to write a .bat script that will automatically create a launch configuration and then an auto scaler. The aim is for an image that was previously set up about a week ago by a coworker.

The problem I encounter is that when I run the script, no commands past the launch configuration command is executed.

The code is here:

echo Beginning Auto Scale Up Process

REM Create a launch config
as-create-launch-config --image-id ami-xxxxxxx --instance-type t1.micro --user-data "Created by Launch Config reportingServerScaleUp-lc" --launch-config reportingServerScaleUp-lc 

echo Timer Complete

I am looking for suggestions to help me debug this issue. Or advice on how to solve it. After the "echo Timer Complete" I have a command to create an auto scaler. Though, not even the "echo Timer Complete" is executed. The console does return indicating that the launch configuration is created though :)

Also, when I enter each command sequentially into the command line, each executes perfectly. The launch configuration is created as is the auto scale group.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
miss.serena
  • 1,170
  • 1
  • 11
  • 28
  • Perhaps the `as-create-launch-config` is triggering an `exit` somehow. Is there any difference if you prefix that line with `cmd.exe` to launch it in another shell? – paddy May 22 '13 at 23:33
  • you are exactly right, friend. I just added my fix in the answers. I added "call" to each aws command. – miss.serena May 23 '13 at 00:05

1 Answers1

6

It turns out that the AWS commands call exit which exits the .bat script prematurely.

Prepending each AWS command with "call" did the trick.

I found suggestions in this question: Why does only the first line of this Windows batch file execute but all three lines execute in a command shell?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
miss.serena
  • 1,170
  • 1
  • 11
  • 28