3
votes

Currently, I'm developing a native application using React-Native. I've decided to go with AWS Amplify because of it's real time updates as well as its authentication.

I also have a Web Application that runs on a Node.js with Epxress server. This web application connects to a Mongo database.

My big problem is that I would like to have all of my aws amplify queries run to my existing MongoDb instead of a new dynamoDb database which is provided with AWS AppSync, but unfortunately I dont know where to start. This is especially helpful in adding authentication easily in my existing web application as well.

My first idea was to just create all my API endpoints in a new node js server and have app sync call to these API end points, but I'm not sure how to implement calling end points on an existing server (and this seems kind of counter intuitive to the 'serverless' idea)

My other idea came from this: Can AWS App-Sync be used without dynamoDB

This states to use AWS Lambda to 'pipeline' my data to the existing mongodb, but I'm not really sure what that entails.

TL;DR - I would like to be able to query an existing Mongodb instead of using DynamoDb when using AWS Amplify with AppSync.

I hope this is clear enough and doesn't sound like I'm rambling. Thanks in advance!

1

1 Answers

3
votes

I would suggest using either an HTTP datasource to connect to your MongoDB backend or a Lambda function. Here are a couple getting started tutorials for both:

https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-http-resolvers.html https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html

If you go the Lambda route, then you can leverage the new @function feature of the GraphQL Transformer in the Amplify CLI: https://aws-amplify.github.io/docs/cli/graphql#function