2

I am using the AWS PHP SDK. I have millions of records in my RDS that contain large JSON files. I'd like to send all of these into DynamoDB for easier querying and logging instead of bombarding my RDS DBs.

Unfortunately I get this error anytime that I try to add a new record (putItem). Can you help?

<br />
<b>Fatal error</b>:  Uncaught Aws\DynamoDb\Exception\DynamoDbException: AWS Error Code: SerializationException, Status Code: 400, AWS Request ID: IBB453LGDITFME8Q1G87AP9RCJVV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error Type: client, AWS Error Message: Start of list found where not expected, User-Agent: aws-sdk-php2/2.7.7 Guzzle/3.9.2 curl/7.28.1 PHP/5.5.10
  thrown in <b>/Users/alex/Development/AWS/PHP SDK/Aws/Common/Exception/NamespaceExceptionFactory.php</b> on line <b>91</b><br />

Here is my PHP code: https://gist.github.com/nyalex/9004acbc4b2cabd5333b

1 Answer 1

1

I figured it out. I wasn't using the proper array format for the putItem() input. Here is what worked for me:

// Convert JSON for AWS
$m = new Marshaler();

// Send to DynamoDB
$result = $client->putItem(array(
    'TableName' => 'test',
    'Item' => $m->marshalItem(
        array(
            'client_id'      => 100,
            'order_id'      => '200',
            'time'    => time(),
            'order' => $order_json
        )
    ),
    'ReturnConsumedCapacity' => 'TOTAL'
));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.