* Which Category is your question related to? *
amplify rest api
* What AWS Services are you utilizing? *
DynamoDB
* Provide additional details e.g. code snippets *
I setup graphql api and some DynamoDB tables are created.
(I write schema.graphql and run "amplify push")
And I'd like to operate DynamoDB data by rest api and lambda function.
(a user post api some data, then modify them by lambda function, and insert results into DynamoDB)
I run these commands, but an error occurred.
$ amplify add api
? Please select from one of the below mentioned services REST
...
? Choose a Lambda source Create a new Lambda function
...
? Choose the function template that you want to use: CRUD function for Amazon DynamoDB table (Integration with Amazon API Gateway and Amazon DynamoDB)
? Choose a DynamoDB data source option Use DynamoDB table configured in the current Amplify project
There are no DynamoDB resources configured in your project currently
How can I setup rest api with DynamoDB (which is created by amplify graphql shema) ?
Amplify CLI does not expose the DynamoDB table created by GraphQL Transformer. I am marking this as a feature request and putting this in our backlog
Thank you for answering my question.
I find these amplify-cli option
? Choose the function template that you want to use: Serverless express function (Integration with Amazon API Gateway)
? Do you want to access other resources created in this project from your Lambda function? Yes
? Select the category auth, api
Is this rest api can use GraphQL queries and mutations, and modify DynamoDB data?
If this can, how can I setup mutations and queries with @auth on lambda function?
type Secret
@model
@auth(
rules: [
{ allow: groups, groups: ["Admin"], operations: [create, update, delete] }
]
) {
id: ID!
text: String!
}
export const createSecret = `mutation CreateSecret($input: CreateSecretInput!) {
createSecret(input: $input) {
id
text
}
}
`;
@yuth Can you suggest a workaround for this until there is better integration between adding APIs vs functions?
If I just want a function that will use data in a table populated through my GraphQL api, what are my steps?
@yuth any update on this issue?
So why is there an option for Amazon DynamoDB Stream when you create a DynamoDB trigger form the CLI? What is this for then, if it can't access the tables?
This feature was implemented by @ambientlight in #2463 and is available in the latest version of the CLI
@yuth Can you suggest a workaround for this until there is better integration between adding APIs vs functions?
If I just want a function that will use data in a table populated through my GraphQL api, what are my steps?
Hi - Could someone from the dev team answer this? Proving to be very difficult to get this working
To summarize (using amplify 4.16.1), when I use amplify add api, at this step:
*Choose a DynamoDB data source option Use DynamoDB table configured in the current Amplify project
I get:
_There are no DynamoDB resources configured in your project currently_
What is it that I need to do to make my tables generated by graphql available ?? @ambientlight @yuth @edwardfoyle
This was released in version 4.18. You'll need to update to the latest version (now 4.22.0) to use this feature.
This Issue has clear steps on how to use this feature.
https://github.com/aws-amplify/amplify-cli/issues/3693
Most helpful comment
@yuth Can you suggest a workaround for this until there is better integration between adding APIs vs functions?
If I just want a function that will use data in a table populated through my GraphQL api, what are my steps?