I inherited a site that uses DynamoDB for its database, which I know nothing about unfortunately, and I'm trying to change a user's email for them. There appears to be a users table in DynamoDB, but I don't know the user's id, only their username and current email, so at this point, I am just trying to find the record before updating it. When I attempt to scan for these values in the web interface, I get no results; it just keeps searching. If I scan in the web interface for an email address which I know exists, I also get no results.

Using these placeholder values,

Username: example
Email: example@example.com

I have tried a few commands using AWS CLI, but I get various errors:

aws dynamodb get-item --table-name users --key '{"Username": {"S": "example"}}'

This yields this error:

Unknown options: example}}', {S:

I have also tried this:

aws dynamodb query --table-name users --key-condition-expression "Username = :v1" --expression-attribute-values "{ \":v1\" : { \"S\" : \"example\" } }"

This yields this error:

An error occurred (ValidationException) when calling the Query operation: Query condition missed key schema element: id

I have also tried printing out all users, but it appears to fail for anything but the smallest tables:

aws dynamodb scan --table-name users

This yields this error:

An error occurred (ProvisionedThroughputExceededException) when calling the Scan operation (reached max retries: 2): The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.

Not sure what to do at this point. Any advice?


It sounds like only the key or global secondary indexes can be efficiently searched in DynamoDB, which can be accomplished via the query() function, from my brief research. I'm honestly no DynamoDB expert, only have read up on it in the past, but this StackOverflow answer might be helpful for what you're trying to accomplish. Essentially it recommends creating a global secondary index on the field you're trying to use for searching.

  • Thanks for the help! AWS support got back to me. The answer was to change my table read/write capacity from provisioned to on-demand and to use scan instead of query, since query only operates with the id. I appreciate your help though! – kloddant Feb 4 at 14:29
  • 1
    @kloddant No problem, unfortunately a lot of AWS's documentation is missing important details (despite them having a verbose set of documents). Usually I find questions pertaining to their products are best handled by their support team or your account rep. You can do a query like I mentioned but you'd have to implement the GIS, if you wanted a performant way to accomplish that, otherwise yes a scan of the entire table should work too. – J.D. Feb 4 at 15:33

I contacted AWS support, and they said two things:

  1. The read/write capacity of the table needed to be changed from "provisioned" to "on-demand".

  2. Scan is definitely the command to use here, not query; query requires the id, scan does not.

    aws dynamodb scan --table-name users --filter-expression "Username = :v1" --expression-attribute-values "{ ":v1" : { "S" : "example" } }"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.