Closed widdydev closed 6 years ago
Hello @getsbydev, any improvement ? Can you share your code ?
Hey @romainquellec yeah I already figured it out how to successfully connect the Amazon AppSync service with a RDS via a lambda-function. In the next days, I'm going to create a small repository to share my implementation.
Thanks ! ping me then ;)
@getsbydev @romainquellec key is to make sure lambda has access to RDS (VPC settings are correct). Then you can use the lambda + graphql code in appsync (with correct templating) and it should work!
@getsbydev Any code to share with the community ? Thanks !
@romainquellec I created a repository with my implementation. Feel free to leave some feedback!
Hey @getsbydev thanks for sharing. Is your lambda within a VPC? I tried and implement something similar, but I'm experiencing cold starts up to 10s (!)
@mattbt my lambda is currently not within a VPC and the executing times vary from 2ms to 200ms.
@getsbydev thx a lot for your code ! Great help !
For those who are using the pg
module : knex is using it at runtime and so you will have to require it manually in your code to force the inclusion in the bundle. Otherwise it won't be included and knex will crash.
Or you can add this in your serverless.yml
file :
custom:
webpack:
includeModules:
forceInclude:
- pg
@getsbydev thanks, and is your RDS instance in a VPC? if so, how do you restrict access to RDS only to that Lambda? I have not found an answer yet, beside putting Lambda in the VPC itself (and therefore experiencing cold starts).
I'm struggling with the combination of AppSync and Amazon RDS. I tried the implementation of the standalone rds, and the appsync examples provided in the repository. These are working like a charm. But obviously there are many differences and difficulties if you'd like to combine these technologies. I used the schema, resolver and handler functions from the rds directory and combined it with the appsync lambda implementation. I adjusted the mapping templates and updated the serverless.yml file. I could successfully deploy the whole appsync service and all resources without any errors. I'm able to access the graphql endpoint from graphiql and do my queries. But when I try it from the appsync console I get null as a response. I guess it has something to do with the mapping templates, but I'm not quite sure. Has anybody got any suggestions or maybe a working example of this specific combination?