amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

DynamoDB Storage usage question

Open schko opened this issue 5 years ago • 5 comments

I'm trying to import a DynamoDB table as an Amplify storage option, but am facing issues simply listing the entries of the table.

Amplify CLI Version 4.41.1

To Reproduce

  1. Use https://docs.amplify.aws/cli/storage/import#import-an-existing-dynamodb-table to import a table
  2. Push
  3. Try to list all the entries using:
Storage.list('') // for listing ALL files without prefix, pass '' instead
    .then(result => console.log(result))
    .catch(err => console.log(err));

Expected behavior Expected for my database entries to be listed.

Desktop (please complete the following information): On Cloud9 environment

Additional context In the console, I'm getting the following warning, which is specific to S3 bucket imports I think: MissingRequiredParameter: Missing required key 'Bucket' in params

schko avatar Jan 15 '21 02:01 schko

The client operation you are running (Storage.list) only works with S3 not DynamoDB. You need to connect your DynamoDB table up to a REST or GraphQL API to call it from a client.

undefobj avatar Jan 15 '21 02:01 undefobj

I see, thank you! I have my table set up in AppSync, and want to import it, rather than remove the table currently created by my Amplify environment (so basically have two tables accessible in my app). I think in that case I can't simply use amplify add codegen --apiId right?

What would you recommend in this case?

schko avatar Jan 15 '21 02:01 schko

@schko what is the exact use case you are trying to solve? You have an AppSync API deployed by "Project A" and you like to use the same AppSync API from "Project B"?

I would suggest to not to access the DynamoDB table directly if you are accessing and changing data through AppSync API, since you can end up in hard to debug problems with your data. If you just like to read the data directly, but not modifying it when accessing the table directly, that's a better case.

attilah avatar Jan 15 '21 19:01 attilah

Closing due to lack of further communication/response.

kaustavghosh06 avatar Jan 28 '21 01:01 kaustavghosh06

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 25 '21 06:05 github-actions[bot]