File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,11 +136,24 @@ ELB_NAME=$(aws elb describe-load-balancers \
136136 $EXTRA_AWS_CLI_ARGS | grep -F $ELB_DNS_NAME | head -n1 | cut -f2)
137137echo " Using ELB $ELB_NAME at $ELB_DNS_NAME "
138138
139- FIRST_INSTANCE=$( aws ec2 describe-instances \
140- --filters Name=tag:aws:cloudformation:stack-name,Values=$STACK_NAME Name=instance-state-name,Values=running \
141- --query ' Reservations[].Instances[].[PublicIpAddress]' \
142- --output text \
143- $EXTRA_AWS_CLI_ARGS | head -1)
139+ # Instance launched into a VPC may not have a PublicIPAddress
140+ for ip_type in PublicIpAddress PrivateIpAddress; do
141+ FIRST_INSTANCE=$( aws ec2 describe-instances \
142+ --filters Name=tag:aws:cloudformation:stack-name,Values=$STACK_NAME Name=instance-state-name,Values=running \
143+ --query " Reservations[].Instances[].[$ip_type ]" \
144+ --output text \
145+ $EXTRA_AWS_CLI_ARGS | head -1)
146+ if [[ ! $FIRST_INSTANCE == " None" ]]; then
147+ break
148+ fi
149+ done
150+
151+ if [[ $FIRST_INSTANCE == " None" ]]; then
152+ echo_red " The IP of any of your instances could not be found."
153+ echo_red " Ensure that the cloudformation stack was created successfully."
154+ exit 1
155+ fi
156+
144157export DEISCTL_TUNNEL=$FIRST_INSTANCE
145158
146159# loop until etcd2 / fleet are up and running
You can’t perform that action at this time.
0 commit comments