From 23dbb652a81db0f7e7f945aaad4331e6298bf74c Mon Sep 17 00:00:00 2001 From: Kemal Yaylali Date: Mon, 28 Sep 2026 17:44:26 +0100 Subject: [PATCH] cloud: optional AZ for spot launches --- scripts/cloud/trial.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/cloud/trial.sh b/scripts/cloud/trial.sh index b1dacd6..3ac307e 100755 --- a/scripts/cloud/trial.sh +++ b/scripts/cloud/trial.sh @@ -17,6 +17,7 @@ TYPE=${TYPE:-m7g.4xlarge} MAX_PRICE=${MAX_PRICE:-0.30} # USD/hour spot cap (on-demand is 0.6528) MAX_MINUTES=${MAX_MINUTES:-360} # hard cap: 6 hours DISK_GB=${DISK_GB:-250} +AZ=${AZ:-} # e.g. us-east-1b when another zone's spot price is above MAX_PRICE DISK_MBPS=${DISK_MBPS:-125} # gp3 throughput (125 = free baseline; each extra MB/s ~ $0.00005/h) DISK_IOPS=${DISK_IOPS:-3000} # gp3 IOPS (3000 = free baseline) BUDGET_USD=${BUDGET_USD:-10} @@ -73,7 +74,7 @@ launch) echo "-> task: $TASK" echo "-> launching $TYPE spot (cap \$$MAX_PRICE/h, hard limit ${MAX_MINUTES} min, ${DISK_GB} GB disk deleted on exit)" ID=$($AWS ec2 run-instances --image-id "$AMI" --instance-type "$TYPE" --count 1 \ - --iam-instance-profile Name=$ROLE \ + --iam-instance-profile Name=$ROLE ${AZ:+--placement AvailabilityZone=$AZ} \ --instance-initiated-shutdown-behavior terminate \ --instance-market-options "MarketType=spot,SpotOptions={MaxPrice=$MAX_PRICE,SpotInstanceType=one-time,InstanceInterruptionBehavior=terminate}" \ --block-device-mappings "DeviceName=/dev/sda1,Ebs={VolumeSize=$DISK_GB,VolumeType=gp3,Throughput=$DISK_MBPS,Iops=$DISK_IOPS,DeleteOnTermination=true}" \