Setup problems: AWS


Don’t know how to solve the following issue when doing aws configure.

“Invalid endpoint: https://ec2.Default region name [us-wetst-2 st-2]:

The following shows default region name in my AWS configure:
$ aws configure
AWS Access Key ID [****************CSCQ]: ****************CSCQ
AWS Secret Access Key [****************t1Nj]: ****************t1Nj
Default region name [Default region name [us-wetst-2 st-2]: us-west-2]: us-west-2
Default output format [text]: text

More information as follows:
When I remove default information, the default region part is still weird.

$ aws configure
AWS Access Key ID []:
AWS Secret Access Key [
Default region name [Default region name [us-wetst-2 st-2]: us-west-2]:
Default output format []:

Thank you!



I’m based off US and using AWS us-west-2 but getting the following error on Cygwin.

myname@GACDTL07NH3096 ~
$ wget
–2017-08-22 15:46:19--
Connecting to||:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 528 [text/plain]
Saving to: ‘’ 100%[============================================================================>] 528 --.-KB/s in 0s

2017-08-22 15:46:19 (2.84 MB/s) - ‘’ saved [528/528]

myname@GACDTL07NH3096 ~
$ bash
Only us-west-2 (Oregon), eu-west-1 (Ireland), and us-east-1 (Virginia) are currently supported

The region seems to be correct, so I don’t know what went wrong…
myname@GACDTL07NH3096 ~
$ aws configure get region

Thanks so much!



  1. Run rm ~/.aws/config
  2. Run aws configure again.

Everything will be reset.

(George Zhang) #756

Hi Jeremy,

I looked through the alias scripts you provided and spotted a few syntax errors. These could lead your aliases to have different behaviors than what they claimed. People who have abnormal behaviors with the aliases might benefit from this post.

Here is one of them:

alias aws-get-p2='export instanceId=`aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped,Name=instance-type,Values=p2.xlarge" --query "Reservations[0].Instances[0].InstanceId"` && echo $instanceId'

Wow. That is a mouth full. Let’s zoom in and focus on where the problem lies.

aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped,Name=instance-type,Values=p2.xlarge"

Here Jeremy is trying to filter out only the instances that are stopped and have p2.xlarge as instance-type. However, the option values for aws ec2 describe-instances --filter are written in wrong syntax. Here is the correct syntax as specified in AWS-CLI refernce page of the command:

Name=string,Values=string,string ...

The most important thing to notice here is that we have to use space to separates different values of the same option, not comma. Look again at the option part of the command:

--filters "Name=instance-state-name,Values=stopped,Name=instance-type,Values=p2.xlarge"

It puts two option values in one pair of quotes and tries to separate them with comma. Though it appears to make sense, it is not the correct syntax. Here the filter option is simply ignored as bad syntax argument. So it is actually not filtering anything.

To make things a bit more clear, here is an reference page example that also uses two filters:

aws ec2 describe-instances --filters "Name=instance-type,Values=m1.small,m1.medium" "Name=availability-zone,Values=us-west-2c"

Pay attention to how the two filters are in two separate pairs of quotes.

So, the problematic part of our original command should be rewritten as:

aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped" "Name=instance-type,Values=p2.xlarge"

Because of the special importance of space in syntax, we must not separate Name and Values with space.

Name=instance-state-name, Values=stopped

With only one extra space, the whole thing will blow up.

These adjustment should address some of the problems people might face while using the aliases.


(michael) #757

Thx a lot

(Nikhil Utane) #758

Hi, I am facing peculiar problem while running
The AWS commands seem to be be returning some unexpected character because of which subsequent commands fail.

For e.g.

$ export region=`aws configure get region`
$ echo $region

Still when I run the script, the if condition fails and I get

“Only us-west-2 (Oregon), eu-west-1 (Ireland), and us-east-1 (Virginia) are currently supported”

I tried using $ syntax but still getting same problem.

export region=$(aws configure get region)

However it works fine if I manually set region.

export region=“us-west-2”

This is happening for every aws command and it is difficult to keep doing it manually for all commands.

Has anybody else faced the same issue? I am on Windows 7

(Nikhil Utane) #759

Found that it is the last NULL termination character which is creating the problem. Once you get rid of it, then it works.
You can remove it using:

$ export region=${region::-1}

You’ll have to do it for all aws commands.

There aren’t many references to this issue other than one that Martie raised 5 days ago. Did anything change recently? Thanks.

(Manishankar) #760

Trying to set up p2 instance, facing issues in connecting with the server. I’ve managed to setup the server using and verified in AWS console that the server is running, but getting ‘Connection timed out’ message on port 22 as below. I’ve tried Terminating the server and setting up again some 3 times, ensured all resources are cleared as per instructions on the Wiki page.

gbs@gbs-PC ~
$ ssh -i /home/gbs/.ssh/aws-key.pem
ssh: connect to host port 22: Connection timed out

Kindly help. TIA.

(Saurabh Mittal) #763

Hey Manishankar, Are you using the scripts from git or the obsolete links from etc?
Secondly, it appears to me that there are at least two issues in your ssh command:

  1. Its using an old name : aws-key.pem instead of aws-key-fast-ai.pem
  2. You seem to be on Windows, but using the username as ubuntu

(Saurabh Mittal) #764

Hi,Just wondering if this could have been due to the encoding that changes between DOS and Unix for example?

( #765

When i check .aws/credentials : i get -
/home/DELL/.aws/credentials: line 1: $’[default]\r’: command not found
/home/DELL/.aws/credentials: line 2: aws_access_key_id: command not found
/home/DELL/.aws/credentials: line 3: aws_secret_access_key: command not found

( #766

When i do this : ~/.aws/credentials
I get :
/home/DELL/.aws/credentials: line 1: $’[default]\r’: command not found
/home/DELL/.aws/credentials: line 2: aws_access_key_id: command not found
/home/DELL/.aws/credentials: line 3: aws_secret_access_key: command not found


I had the same problem, and then I realized that my AWS user didn’t have “AdministratorAccess” permission. Add this permission in AWS IAM to my user fixed the problem.

(Nikhil Utane) #768

But why now? I didn’t do anything different than what many others would have done on windows platform. The scripts should have handled these things by now. Isn’t it?


(Saurabh Mittal) #769

Exactly - why now :slight_smile: ?
Hence you need to see what is it that you are doing differently from others…Given that this course has been running for almost an year now.

BTW, scripts wouldn’t handle the DOS vs Unix thing, that would need to be done via dos2unix utility as alluded earlier and pointed by many others as well.

If you are manually truncating last character from all the commands, then it certainly seems that the issue is caused due to this only.

(Manishankar) #770

Hi Saurabh,
Thanks for responding. I was using the script from (read somewhere on the forum that the links from are obsolete and that should be used). Will try using the scripts grom git. thanks again, cheers!

(Nikhil Utane) #771

Nothing to do with script. The same problem can be seen when command is run manually. If you scroll up earlier Martie also reported the issue 5 days ago. That’s why I doubted if something changed recently.

(Fenil Suchak) #773

After running the instance successfully and generating the instance id, while connecting it via ssh I get the following error,
ssh: connect to host port 22: Connection refused

Any idea? how to get around this?

(shuvi) #774

I got the following error while after I input the command “pip install awscli”. How dangerous can this be?

/Library/Python/2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see


Hello all.

There is an time out error, when I use Jeremy’s

First, when
alias aws-get-t2=‘export instanceId=aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped,Name=instance-type,Values=t2.micro" --query "Reservations[0].Instances[0].InstanceId" && echo $instanceId’

I run aws-get-t2, I get the ERROR:
(‘Connection aborted.’, error(61, ‘Connection refused’))

and when I change aws-get-t2 to below:
alias aws-get-t2=‘export instanceId=aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped" "Name=instance-type,Values=t2.micro" --query "Reservations[0].Instances[0].InstanceId" && echo $instanceId’

I run aws-get-t2, I get the ERROR:
HTTPSConnectionPool(host=‘’, port=443): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<botocore.awsrequest.AWSHTTPSConnection object at 0x10aa18d50>, ‘Connection to timed out. (connect timeout=60)’))

And I have made sure My t2.micro is running all the time.

Can @jeremy and someone give me some hints and guide ? Thanks.