aws cli get error "The security token included in the request is invalid"

amazon-web-services, aws-cli

Solution

Do you have MFA enabled on your account? You might have to run

aws sts get-session-token

Details for how to use MFA with the cli are documented here.

Problem

I did `aws configure` and test it worked before. But it didn't work today, I got the the error when tried to get hosted zone ``` $ aws route53 list-hosted-zones An error occurred (InvalidClientTokenId) when calling the ListHostedZones operation: The security token included in the request is invalid. ``` I deleted ~/.aws and did `aws configure` again, but I still got the same error. Could you please help? Thanks!

Original source