Hi,I just installed boto and am trying to use it to create tables and load data into DynamoDB. When I try to simply create a table I get a JSONResponseError that the security token included in the request is invalid.>>> from boto.dynamodb2.table import Table>>> from boto.dynamodb2.fields import HashKey>>> users = Table.create('users', schema=[HashKey('username')])Traceback (most recent call last):File "<stdin>", line 1, in <module>File "boto/dynamodb2/table.py", line 196, in create**kwargsFile "boto/dynamodb2/layer1.py", line 368, in create_tablebody=json.dumps(params))File "boto/dynamodb2/layer1.py", line 1479, in make_requestretry_handler=self._retry_handler)File "boto/connection.py", line 854, in _mexestatus = retry_handler(response, i, next_sleep)File "boto/dynamodb2/layer1.py", line 1521, in _retry_handlerdata)boto.exception.JSONResponseError: JSONResponseError: 400 Bad Request{u'message': u'The security token included in the request is invalid.', u'__type': u'com.amazon.coral.service#UnrecognizedClientException'}I verified that my credentials work for other resources, namely S3:>>> s3 = boto.connect_s3()>>> bucket = s3.get_bucket('XXXXX')>>> key = bucket.new_key('new-test-key')>>> key.set_contents_from_string('This is a test of S3')20The IAM policy for my user is pretty comprehensive -{"Statement": [{"Effect": "Allow","Action": "*","Resource": "*"}]}And I can create/delete tables using the web interface. So I'm wondering what I'm missing in my boto configuration. I've included default region info for DynamoDB in my .boto fileAny help would be appreciated.Thanks,Trevor
[Tue Dec 10 21:09:51 2013] [error] [client 216.38.150.34] JSONResponseError: JSONResponseError: 400 Bad Request
[Tue Dec 10 21:09:51 2013] [error] [client 216.38.150.34] {u'message': u'The security token included in the request is invalid.', u'__type': u'com.amazon.coral.service#UnrecognizedClientException'}2013-12-10 21:04:26,835 [DEBUG] Command 60-list-home-directory output: total 36
-rw-r--r-- 1 root root 129 Jan 15 2011 .tcshrc
-rw-r--r-- 1 root root 100 Jan 15 2011 .cshrc
-rw-r--r-- 1 root root 176 Jan 15 2011 .bashrc
-rw-r--r-- 1 root root 176 Jan 15 2011 .bash_profile
-rw-r--r-- 1 root root 18 Jan 15 2011 .bash_logout
dr-xr-xr-x 23 root root 4096 Dec 10 19:46 ..
drwx------ 2 root root 4096 Dec 10 19:46 .ssh
dr-xr-x--- 3 root root 4096 Dec 10 20:58 .
-rw-rw-rw- 1 root root 169 Dec 10 21:04 .botoOn 12/10/2013 01:46 PM, Andrey Myatlyuk wrote:
>>> Here are my commands:
>>>
>>> 50-copy-boto-configuration-to-home:
>>> command: "cp .ebextensions/boto.cfg ~/.boto"
>>>
>>> 60-list-home-directory:
>>> command: ls -ltra ~/
>>
>> So where are you running these commands from and what are they? In other words what program are you using to interact with the machine?
> Ah, I was so deep into my project, that forgot to mention the environment. I'm using boto on AWS Elastic Beanstalk. And those commands are executed by the container initializer. I have ssh access to instances, but the idea to bring maximum automation.
Well my method when troubleshooting is to work from simple to complex.
To that end I strip out as much of the overlying code as possible and
get back down to the basics and make sure they work and then add back
the layers one by one to see if I can identify the issue(s). So in this
case run boto independent of Beanstalk and see what happens.
[ec2-user@ip-172-xx-xx-xx app]$ pythonNow, within my application I added method with exactly the same code:
Python 2.6.8 (unknown, Mar 14 2013, 09:31:22)
[GCC 4.6.2 20111027 (Red Hat 4.6.2-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from boto.pyami.config import Config
>>> config = Config()
>>> config.dump()
[DEFAULT]
debug = 0
working_dir = /mnt/pyami
[DynamoDB]
region = us-west-1
[Credentials]
aws_access_key_id = (proper value from config file)
aws_secret_access_key = (proper value from config file)
[Boto]
debug = 1
>>> quit()
[Tue Dec 10 23:36:22 2013] [error] [DEFAULT]
[Tue Dec 10 23:36:22 2013] [error] debug = 0
[Tue Dec 10 23:36:22 2013] [error] working_dir = /mnt/pyami
[Tue Dec 10 23:36:22 2013] [error]
[Tue Dec 10 23:36:22 2013] [error] [Credentials]
[Tue Dec 10 23:36:22 2013] [error] aws_access_key_id = (proper value from config file)
[Tue Dec 10 23:36:22 2013] [error] aws_secret_access_key = (proper value from config file)
[Tue Dec 10 23:36:22 2013] [error]
[Tue Dec 10 23:36:22 2013] [error] [DynamoDB]
[Tue Dec 10 23:36:22 2013] [error] region = us-west-1
[Tue Dec 10 23:36:22 2013] [error]
[Tue Dec 10 23:36:22 2013] [error] [Boto]
[Tue Dec 10 23:36:22 2013] [error] debug = 1[Wed Dec 11 00:37:20 2013] [error] [client 216.38.150.34] JSONResponseError: JSONResponseError: 400 Bad Request [Wed Dec 11 00:37:20 2013] [error] [client 216.38.150.34] {u'message': u'The security token included in the request is invalid.', u'__type': u'com.amazon.coral.service#UnrecognizedClientException'}
--
Adrian Klaver
adrian...@gmail.com
--
Adrian Klaver
adrian...@gmail.com
--