简体   繁体   中英

Error: “The security token included in the request is invalid” when using Boto python

I am getting this error when I run my django project on nginx. I use dynamodb for database and S3 for serving static files in the project. The project runs fine when operated on localhost.

The project originally was hosted in another ec2 instance where it ran like charm. I fired up a new ec2 instance from an image of that instance. And now it is throwing this error. The thing is,

the connection works fine when I run some test code on the command line.

But throws this error when the project runs.

JSONResponseError at /

JSONResponseError: 400 Bad Request
{u'message': u'The security token included in the request is invalid.', u'__type': u'com.amazon.coral.service#UnrecognizedClientException'}
Request Method: POST
Request URL:    http://ec2-54-200-144-115.us-west-2.compute.amazonaws.com/?attempt=1&code=AQBfOzPR4Hlgrpkjz-qXQj8b7OLq6cm1NM_oZf64Wz3EmlX2-VDS6qfZ5V5f0Tmbx4MrLc4SGuJxUHa8drQClz3A1IWMVqUGKLEEW_0ol1RqClI8cZViWreBm5c3HJ-Vp48Xx81a7gvXSjRNJUn-kazXqahDrgsAeLez_8FrXIb_HWHyekhnUmxgkskRGBNzcTtpqASNe3agzG3ZZowCMYi6bDBAdVuODli3ApWQWENSmjLaN5QbZWbGo3ATvJNMAUQjj6VTHCkVS-UWcuh-PtwAAFtUqb8HkLsbFG31KevwPKz6x10ojD45pe03zA1SF_g
Django Version: 1.5
Exception Type: JSONResponseError
Exception Value:    
JSONResponseError: 400 Bad Request
{u'message': u'The security token included in the request is invalid.', u'__type': u'com.amazon.coral.service#UnrecognizedClientException'}
Exception Location: /srv/www/test/local/lib/python2.7/site-packages/boto/dynamodb2/layer1.py in _retry_handler, line 1530
Python Executable:  /srv/www/test/bin/python
Python Version: 2.7.3

Can't understand what's going on. Can anyone help me?

You are getting this message since the security credentials / Access Keys for your AWS account has been changed.

Try again with new access keys it will work.

All the best.

Are you using a newer version of python 2.7? I had a similar error with this because of the ssl fixes. I was doing this and it worked

import ssl
# for fix to python on mac which is newer than the one on linux
ssl._create_default_https_context = ssl._create_unverified_context

because none of the solutions worked here was the solution for me.

on a mean stack, I had to run as sudo

sudo forever start startme.js

or

sudo node startme.js

when i did NOT use 'sudo', I received the error:

UnrecognizedClientException: The security token included in the request is invalid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM