#!/bin/bash
# Set the AWS profile
export AWS_PROFILE=tensorfuse
# Verify correct account before proceeding
ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text)
echo "Running for AWS Account: $ACCOUNT_ID"
read -p "Is this the correct sub-account? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Aborting..."
exit 1
fi
# Define the quota codes and regions
QUOTA_CODES=(
"L-417A185B" # Running On-Demand P instances
"L-3819A6DF" # Running On-Demand G and VT instances
"L-1216C47A" # Running On-Demand Standard instances
)
REGIONS=(
"us-east-1"
"us-east-2"
)
# Loop through each region and quota code
for region in "${REGIONS[@]}"; do
echo "Processing region: $region"
for quota_code in "${QUOTA_CODES[@]}"; do
echo "Requesting quota increase for code: $quota_code"
aws service-quotas request-service-quota-increase \
--service-code ec2 \
--quota-code "$quota_code" \
--desired-value 200 \
--region "$region"
# Wait a bit between requests to avoid throttling
sleep 2
done
done