//Karthik Srinivasan

Product Engineer, CTO & a Beer Enthusiast
Experiments, thoughts and scripts documented for posterity.

Quirky Personal Projects

LinkedIn

Email me

Deploying to AWS lambdas to multiple regions

March 5, 2019

Bash script to deploy to all regions using Apex UP

List of all regions where you can deploy with AWS Lambda:

#!/usr/bin/env bash

produrls=()

declare -a regions=(
	us-east-2	#US East (Ohio)
	us-east-1	#US East (N. Virginia)
	us-west-1	#US West (N. California)
	#us-west-2	#US West (Oregon)
	ap-east-1	#Asia Pacific (Hong Kong)
	ap-south-1	#Asia Pacific (Mumbai)
	ap-northeast-2	#Asia Pacific (Seoul)
	ap-southeast-1	#Asia Pacific (Singapore)
	ap-southeast-2	#Asia Pacific (Sydney)
	ap-northeast-1	#Asia Pacific (Tokyo)
	ca-central-1	#Canada (Central)
	cn-north-1		#China (Beijing)
	cn-northwest-1	#China (Ningxia)
	eu-central-1	#EU (Frankfurt)
	eu-west-1	#EU (Ireland)
	eu-west-2	#EU (London)
	eu-west-3	#EU (Paris)
	eu-north-1	#EU (Stockholm)
	me-south-1	#Middle East (Bahrain)
)

for region in "${regions[@]}"
do
    echo "Deploying to $region"
    AWS_REGION=$region up deploy production
    echo "Deployed: " $(AWS_REGION=$region up url -s production)
	produrls+=($(AWS_REGION=$region up url -s production))
    echo # echo new line
done

echo "!DONE!"
echo "${produrls[*]}"