Problem while using local dynamoDB container (Boto3 put_item error)

0 votes

I am testing out boto with a local dynamodb docker container, I get this error while putting a new item into the table. The table exists.

from __future__ import print_function # Python 2/3 compatibility
import boto3
import os

os.environ["AWS_ACCESS_KEY_ID"] = "localaccesskey"
os.environ["AWS_SECRET_ACCESS_KEY"] = "password"

conn = boto3.resource('dynamodb', aws_access_key_id="localaccesskey",  aws_secret_access_key="password", region_name='eu-west-1', endpoint_url="http://localhost:8000")

table = conn.Table('Movies')
        'username': 'janedoe',
        'first_name': 'Jane',
        'last_name': 'Doe',
        'age': 25,
        'account_type': 'standard_user',


/usr/bin/python2.7 /home/kshk/PycharmProjects/Skulldogo/
[dynamodb.Table(name=u'Movies'), dynamodb.Table(name=u'devApiConfig'), dynamodb.Table(name=u'devApiKeys'), dynamodb.Table(name=u'devObjectCache'), dynamodb.Table(name=u'devSessionCache'), dynamodb.Table(name=u'test'), dynamodb.Table(name=u'test1'), dynamodb.Table(name=u'test10')]
Traceback (most recent call last):
  File "/home/kshk/PycharmProjects/Skulldogo/", line 52, in <module>
    'account_type': 'standard_user',
  File "/usr/lib/python2.7/site-packages/boto3/resources/", line 518, in do_action
    response = action(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/boto3/resources/", line 83, in __call__
    response = getattr(parent.meta.client, operation_name)(**params)
  File "/usr/lib/python2.7/site-packages/botocore/", line 258, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/", line 548, in _make_api_call
    raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutItem operation: One of the required keys was not given a value

any ideas???

Dec 3, 2018 in Python by ariaholic
• 7,320 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
DynamoDB does not autogenerate the ID when creating new records. Make sure to supply the hash key.

Oh and the range key too when defined.
answered Dec 3, 2018 by charlie_brown
• 7,710 points

Related Questions In Python

+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
0 votes
1 answer

Python UnboundLocalError error while executing script

The reason for this error is that ...READ MORE

answered Jan 22 in Python by Omkar
• 65,850 points
0 votes
1 answer

error while installing pyautoit

Hi @reddy!  According to the Python Documentation, Error code ...READ MORE

answered Jan 27 in Python by Omkar
• 65,850 points
0 votes
1 answer
0 votes
1 answer

AWS S3 uploading hidden files by default

versioning is enabled in your bucket.….... the ...READ MORE

answered Oct 4, 2018 in AWS by Priyaj
• 56,120 points
0 votes
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 56,120 points
0 votes
1 answer

Import my AWS credentials using python script

Using AWS Cli  Configure your IAM user then ...READ MORE

answered Nov 16, 2018 in AWS by Jino
• 5,520 points
0 votes
2 answers
0 votes
1 answer

When I create and remove files rapidly on windows using python I get WindowsError (Error 5)

Here's the short answer: disable any antivirus or ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,710 points
+2 votes
2 answers

How to make a laplacian pyramid using OpenCV python?

down voteacceptTheeThe problem is that you're iterating ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,710 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.