Where to get proper `region name` and `output format` for AWS configuration?

AWS Access Key ID [None]: enter key id
AWS Secret Access Key [None]: enter access key
Default region name [None]: enter region code for instance connected with
Default output format [None]: leave empty or not

Input for Default region name has to match the region of the instance you're trying to connect with. You can leave output format empty- all it's asking is what format you'd like the output in, but it will spit out whatever is default for the command that you enter.

Here I am trying to find some info on my instance which resides in us-west-2, but I've entered us-east-1 as default region in aws configure, so I get an error.

[root@ip-444-21-27-145 lost+found]# aws configure
AWS Access Key ID [****************IDBA]: 
AWS Secret Access Key [****************BHLx]: 
Default region name [us-west-2]: us-east-1
Default output format [None]: 
[root@ip-444-21-27-145 lost+found]# aws ec2 describe-instances --instance-id i-0a6a6b7e24er203f0 --query 'Reservations[].Instances[].{Name:ImageId,InstanceId:InstanceId,VolumeInfo:BlockDeviceMappings}'

An error occurred (InvalidInstanceID.NotFound) when calling the DescribeInstances operation: The instance ID 'i-0a6a6b7e24er203f0' does not exist

Now, I enter my instance region in aws configure and the command returns what I want.

[root@ip-444-21-27-145 lost+found]# aws configure
AWS Access Key ID [****************IDBA]: 
AWS Secret Access Key [****************BHLx]: 
Default region name [us-east-1]: us-west-2
Default output format [None]: 
[root@444-21-27-145 lost+found]# aws ec2 describe-instances --instance-id i-0a6a6b7e24er203f0 --query 'Reservations[].Instances[].{Name:ImageId,InstanceId:InstanceId,VolumeInfo:BlockDeviceMappings}'
[
    {
        "InstanceId": "i-0a6a6b7e24er203f0", 
        "VolumeInfo": [
            {
                "DeviceName": "/dev/xvda", 
                "Ebs": {
                    "Status": "attached", 
                    "DeleteOnTermination": true, 
                    "VolumeId": "vol-0aa40d5ef1df76968", 
                    "AttachTime": "2017-11-09T02:00:31.000Z"
                }
            }, 
            {
                "DeviceName": "/dev/sdf", 
                "Ebs": {
                    "Status": "attached", 
                    "DeleteOnTermination": false, 
                    "VolumeId": "vol-0a82823250ba51323", 
                    "AttachTime": "2017-11-09T02:09:29.000Z"
                }
            }, 
            {
                "DeviceName": "/dev/sdg", 
                "Ebs": {
                    "Status": "attached", 
                    "DeleteOnTermination": false, 
                    "VolumeId": "vol-0be466f7daa5593e2", 
                    "AttachTime": "2017-11-09T02:35:46.000Z"
                }
            }
        ], 
        "Name": "ami-32d8124a"
    }
]

Hope that helps.


Per the AWS CLI documentation:

--region (string)

The region to use. Overrides config/env settings.

So, just add a --region us-east-1 or whatever to your command and you're all set.