cloud: optional AZ for spot launches
This commit is contained in:
1 parent
3291609577
commit
15d18d9e0e
1 file changed
+2
-1
@@ -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}" \
|
||||
|
||||
Reference in new issue
Block a user