diff --git a/ec2-create-ce b/ec2-create-ce index 618dca8..006acc2 100755 --- a/ec2-create-ce +++ b/ec2-create-ce @@ -411,17 +411,6 @@ ec2-create-tags --region "$AWS_REGION" "$INSTANCE_ID" --tag Purpose="$TAG_PURPOS # assign name (useful for web management console browsing) ec2-create-tags --region "$AWS_REGION" "$INSTANCE_ID" --tag Name="${AMI_NAME}/${DATE_STRING}/${JOB_NAME}/build_${BUILD_NUMBER}" -# assign elastic IP address to instance, -# enabling us to enable access to restricted -# webserver areas -if [ -n "$ALLOCATION_ID" ] ; then - echo "Associating elastic IP $ELASTIC_IP allocation ID ${ALLOCATION_ID} with instance ID $INSTANCE_ID" - ec2-associate-address --region "${AWS_REGION}" --allocation-id "${ALLOCATION_ID}" --instance "${INSTANCE_ID}" -elif [ -n "$ELASTIC_IP" ] ; then - echo "Associating elastic IP $ELASTIC_IP with instance ID $INSTANCE_ID" - ec2-associate-address --region "${AWS_REGION}" "${ELASTIC_IP}" -i "${INSTANCE_ID}" -fi - STATUS="$(ec2-describe-instances --region ${AWS_REGION} --filter instance-id="$INSTANCE_ID" | awk '/INSTANCE/ {print $6}')" echo "Starting instance ID $INSTANCE_ID for ngcp version $NGCP_VERSION" @@ -438,6 +427,17 @@ if [ "$STATUS" != "running" ] ; then bailout 1 fi +# assign elastic IP address to instance, +# enabling us to enable access to restricted +# webserver areas +if [ -n "$ALLOCATION_ID" ] ; then + echo "Associating elastic IP $ELASTIC_IP allocation ID ${ALLOCATION_ID} with instance ID $INSTANCE_ID" + ec2-associate-address --region "${AWS_REGION}" --allocation-id "${ALLOCATION_ID}" --instance "${INSTANCE_ID}" +elif [ -n "$ELASTIC_IP" ] ; then + echo "Associating elastic IP $ELASTIC_IP with instance ID $INSTANCE_ID" + ec2-associate-address --region "${AWS_REGION}" "${ELASTIC_IP}" -i "${INSTANCE_ID}" +fi + HOSTNAME="$(ec2-describe-instances --region ${AWS_REGION} --filter instance-id="$INSTANCE_ID" | awk '/INSTANCE/ {print $4}')" retry=360 # up to 30 minutes