Skip to content

Commit ef6c3be

Browse files
authored
Merge pull request #78 from t-brown/main
Updating to use c5 instances
2 parents 4cc6b3b + 2caa4d5 commit ef6c3be

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

apps/wrf/scripts/setup/SC22_create_parallelcluster_config.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ echo "[INFO] AWS_REGION = ${AWS_REGION}"
3030
# Define Instances seperated by ','.
3131
if [ -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
3434
fi
3535
echo "export INSTANCES=${INSTANCES}" >> env_vars
3636
echo "[INFO] INSTANCES = ${INSTANCES}"
@@ -75,11 +75,16 @@ else
7575
return 1
7676
fi
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

8489
if [[ ! -z $SUBNET_ID ]]; then
8590
echo "export SUBNET_ID=${SUBNET_ID}" >> env_vars

0 commit comments

Comments
 (0)