I am trying to fire up an EC2 instance, wait until it is a "running" state, then set a bamboo variable to the newly created instance id for use to deploy.
Reference: Bash script . I know that is .sh and not windows, but it proves it can be done, and I am working on Windows 2012 based EC2 configurations.
So I set a Bamboo Variable via the Plan Configuration -> Variables(tab)
Name: instance_id, Value: i-xxxxxxx
Then i have a script task (cmd, inline):
echo ${bamboo.instance_id}
EC2_RUN_RESULT=aws ec2 run-instances --image-id ami-xxxxxxx --instance-type t2.micro --key-name KeyName --security-groups launchSecurityGroup
set ${bamboo.instance_id}=EC2_RUN_RESULT.idDoesn't work.
set ${bamboo.instance_id}="abc123"
echo ${bamboo.instance_id}Only returns "i-xxxxxxx"
How do I set a variable? And how do I setup a loop that will wait until the EC2 Instance is in a running state?
Thank you in advance!