In AWS most of the services are either regional or global. If you try to access a regional service like VPC or EC2 and your AWS CLI config file doesn’t have region information and you did not provide the region information during run time as well then you get this error message. The mitigation is very simple and you have two options as listed below –
Option 1: Set the default region details in your AWS CLI config file
1 2 3 4 |
## Execute below command and provide your region code aws configure ## Default region name [None]: |
Option 2: Provide the region details during runtime using –region global AWS CLI parameter
1 2 3 4 5 |
## Get VPC details for a region aws ec2 describe-vpcs --region ## Get the region code aws ec2 describe-regions --query 'Regions[].RegionName' --output text |
You can use the below links to install and configure AWS CLI
https://cloudaffaire.com/how-to-install-aws-cli/
https://cloudaffaire.com/how-to-configure-aws-cli/