I'm currently working on a side project that is PERFECT for a graph database/GraphQL and I'm trying to use Neo4j. I have my ec2 instance of a Neo4j database up and running. I'm trying to leverage all things Amazon, but don't want to use Neptune or Dynamo. That means I am trying to use resolvers and lambda functions as my data source for Appsync to get the job done. I'm definitely a newbie and can already tell Amazon makes things infinitely harder when you aren't using their products. Wondering if anyone has recommendations or tutorials on how I would go about this. THANKS SO MUCH!
Hey Nick -
My Appsync experience is pretty minimal, but my understanding is that you should be able to define lambdas to use as resolver functions for data sources other than Dynamo. So you should be able to use the neo4j driver in these lambdas to connect to / query Neo4j. With this approach you'll need to write Cypher in each resolver.
In theory, you should be able to leverage the neo4j-graphql.js integration in those resolvers, generating the Cypher necessary to resolve an arbitrary GraphQL request - by calling the
neo4jgraphql function in the lambda / resolver, passing it the resolveInfo object that is passed to each resolver. However, I haven't actually tried that so I'm not completely sure it works.
Trying a Neo4j - Appsync demo has been on my list for a while so if I have time I'll give it a try and share the results with you.
I recently attempted to use AWS AppSync as a main GraphQL endpoint to interact with Neo4j running on an EC2 instance and quickly realised it was not yet fully supported. Most importantly, you can't use directives such as @relation or @cypher in AWS AppSync console. The moment you hit "Save", your scheme's SDL gets automatically "cleaned up" effectively removing the aforementioned directives.
For now I just settled for the native Neo4j GraphQL plugin that's running together with the instance of Neo4j.
That being said, now that I'll be switching over to the enterprise edition (and thus will be creating a casual cluster), I'm considering AWS API Gateway that'll be running in a pure "pass through" mode to these Neo4j instances via the load balancer. On the other hand, maybe it's a bit of an overkill and I should just use a simple load balancer in front of my EC2 instances for now?
Has anyone here attempted it? Any thoughts? Is it an acceptable approach until AWS AppSync accommodates for GraphQL directives? How would you go about setting it up?