@@ -30,7 +30,7 @@ echo "[INFO] AWS_REGION = ${AWS_REGION}"
3030# Define Instances seperated by ','.
3131if [ -z ${INSTANCES} ]; then
3232 echo " [WARNING] INSTANCES environment variable is not set, automatically set to c5n.18xlarge,m5.2xlarge."
33- export INSTANCES=hpc6a.48xlarge,m5.2xlarge
33+ export INSTANCES=c5.18xlarge,c5.24xlarge
3434fi
3535echo " export INSTANCES=${INSTANCES} " >> env_vars
3636echo " [INFO] INSTANCES = ${INSTANCES} "
7575 return 1
7676fi
7777
78+ AZ_IDS=use1-az4,use1-az5,use1-az6
79+ AZ_COUNT=` echo $AZ_IDS | tr -s ' ,' ' ' | wc -w`
7880
79- # Find in which Availability Zone Amazon EC2 instances are available.
80- export SUBNET_ID=` aws ec2 describe-subnets \
81- --query " Subnets[?AvailabilityZoneId == 'use2-az2'].SubnetId" \
82- | jq -r ' .[]' `
81+ # Set a subnet id by finding which subnet of the VPC is corresponding to the Availability Zone
82+ # where EC2 instance are available.
83+ export SUBNET_ID=` aws ec2 describe-subnets --query " Subnets[*].SubnetId" \
84+ --filters Name=vpc-id,Values=${VPC_ID} \
85+ Name=availability-zone-id,Values=${AZ_IDS} \
86+ --region ${AWS_REGION} \
87+ | jq -r .[$( python3 -S -c " import random; print(random.randrange(${AZ_COUNT} ))" ) ]`
8388
8489if [[ ! -z $SUBNET_ID ]]; then
8590 echo " export SUBNET_ID=${SUBNET_ID} " >> env_vars
0 commit comments