Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to pass params to DynamoDB PutIte

Issue

As I try to pass parameters to the PutItem query in DynamoDB, I am unable to pass a compound key based on two fields. I have tried using different escape and concat operations but with no success. My DynamoDB table uses a compound key with Item1 as partition key and Item2 as sort key.

Resolution

To pass parameters in the PutItem query for DynamoDB, you can use the template language syntax in the AWS console. To pass a single parameter, use {{Input1.text}} instead of hardcoded data.

However, when dealing with compound keys, concatenate the values of the two fields using backticks, double quotes, and the template syntax. For instance, instead of "S" : "{{Item1.text + ‘#’ + Item2.text}}", use "S" : "{{Input1.text +#+ Input2.text}}".

Using this syntax, you can pass parameters dynamically when inserting items into DynamoDB, including for complex keys. Remember to use the correct data types for other key-value pairs in the PutItem query.