AWS CLI error: The request must contain the parameter AWSAccessKeyId

This is a very misleading and weird error. When running

aws configure

in ubuntu 20.04. If I copied and pasted the key id and secret to the terminal,

it appends something like ^[[200~ and ^[[201~ before and after the copied key and secret. I was not aware of what that was then but it seems to be related to “bracketed paste mode” in terminal

 

When I tried to run the reachability analyzer example

aws ec2 create-network-insights-path --source igw-0797cccdc9d73b0e5 --destination i-0495d385ad28331c7 --destination-port 22 --protocol TCP

I got the error

An error occurred (MissingParameter) when calling the CreateNetworkInsightsPath operation: The request must contain the parameter AWSAccessKeyId

Very misleading indeed! The config and credential files are in ~/.aws. It should have really complained about incorrect credentials instead. It took me a while to realize that ^[[200~ and ^[[201~ were the source of the problem. It runs okay after I removed them inside the credential file.

Leave a Reply

Your email address will not be published. Required fields are marked *