Problem scenario
You run an AWS CLI command, but you get this error message:
"An error occurred (InvalidParameterException) when calling the CreateCluster operation: Subnets specified must be in at least two different AZs"
How do you find subnets in different availability zones?
Solution
Run commands such as these (but replace the "us-west-x" and "us-east-x" with the availability zones that you use):
aws ec2 describe-subnets --query 'Subnets[?AvailabilityZone==us-west-1a]'
aws ec2 describe-subnets --query 'Subnets[?AvailabilityZone==us-west-1b]'
aws ec2 describe-subnets --query 'Subnets[?AvailabilityZone==us-west-1c]'
aws ec2 describe-subnets --query 'Subnets[?AvailabilityZone==us-east-2a]'
aws ec2 describe-subnets --query 'Subnets[?AvailabilityZone==us-east-2b]'
aws ec2 describe-subnets --query 'Subnets[?AvailabilityZone==us-east-2c]'
Now you will see more subnet IDs for your original command. You can supply that original command accordingly and re-run it successfully.