scotto
scotto

Reputation: 73

Invalid endpoint on aws s3 ls

I've just installed AWS Command Line Interface on Windows 10 (64-bit). I ran 'aws configure' providing the two keys, a region value of us-east-1, and took the default json format. Then when I run 'aws s3 ls' I get the following error:

Invalid endpoint: https://s3..amazonaws.com

It's either not taking my region, or putting two dots where there should be one in the link. My /.aws/config file only has these lines in it:

[default]

region = us-east-1

Any ideas why I get 2 dots in place of my region in the s3 link, causing the invalid endpoint error? Thanks for any assistance.

Upvotes: 7

Views: 14531

Answers (5)

ResponsiblyUnranked
ResponsiblyUnranked

Reputation: 1856

In my case it was because I was using aws-vault and was forgetting to prepend the command with:

aws-vault exec {profile_name} -- {command_to_execute}

For example:

aws-vault exec MyProfile -- aws s3 ls

Upvotes: 0

visokoo
visokoo

Reputation: 83

You can also just specify the region on the command line itself like below if you didn't want to rely on the default settings in the ~/.aws/config file...

aws --region us-east-1 s3 cp s3://<bucket> <local destination>

Upvotes: 0

Wale
Wale

Reputation: 379

This can happen if you set AWS_DEFAULT_REGION in your any of .bash_profile or .bashrc

  1. Remove AWS_DEFAULT_REGION in any of those files.

  2. ~/.aws/config should be like this

    [default]

    output = json

    region = eu-west-1

  3. Restart your terminal.

Upvotes: 0

user3399551
user3399551

Reputation: 475

You could also fix this by setting environment variables in your current session for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAULT_REGION.

(in this case your error is actually caused by the CLI not finding a value for the region)

Upvotes: 7

Mausam Sharma
Mausam Sharma

Reputation: 892

I think that's not because of the region because you have already set default to us-east-1 as shown by your /.aws/config file but your output type is not set and double check your access key id and secret access key

it should be like:

enter image description here

enter image description here

also check whether you are able to call other AWS API services such as try to create a dynamodb table using AWS CLI and check whether your IAM user have access permissions to s3 or not.

Upvotes: 3

Related Questions