Amplify CLI/Studio with existing MySQL DB

0

Is there a way to use Amplify CLI/Studio to create a GraphQL/AppSync API without using DynamoDB or any datastore for that matter? I would assume it would just add a comment section to the VQL files where one would have to add the datastore specifics. This would allow me to use the Amplify CLI/Studio toolchain for creating backends that aren't necessarily hooked up to DynamoDB.

Apparently you can only use amplify add api if you want to use a new DynamoDB database. There's a way to make it inspect an existing DB and create GraphQL models from the schema, but that's not what I want. I want to be able to create an api, add my VQL, then push it.

It seems like overkill to have to use raw CloudFormation for something so simple.

1 Answer
0

Thank you for reaching out us regarding the above query. I would like to share that, AWS Amplify CLI currently supports importing serverless Amazon Aurora MySQL 5.6 databases. The detailed approach of integrating the same with Amplify is mentioned in the below article:

[+] https://docs.amplify.aws/cli-legacy/graphql-transformer/relational/

It is also worth noting that AWS AppSync is completely GraphQL based and supports the data sources mentioned in the below article :

[+] https://docs.aws.amazon.com/appsync/latest/APIReference/API_DataSource.html

Hence if you are manually able to configure AppSync to use the VQL datasource by writing custom resolvers, in that scenario you would be able to use the same API in amplify as :

[+] https://docs.amplify.aws/lib/graphqlapi/existing-resources/q/platform/js/#re-use-existing-appsync-graphql-api

However I assume the VQL datasource is hosted outside of AWS (or not), the best approach to retrieve data from the VQL source with Amplify using AppSync API would be to use AWS Lambda as a datasource. Kindly refer to below diagram :

Amplify generated AppSync API ===> AWS Lambda Function as datasource ===> Lambda retrieves data from VQL source .

Please refer to the below articles to setup the above architecture :

  1. Creating AWS Lambda datasource with AppSync in Amplify : https://docs.amplify.aws/cli/graphql/custom-business-logic/#lambda-function-resolver
  2. Using Lambda with Appsync to get data from RDS datasource : https://aws.amazon.com/blogs/mobile/connect-amplify-datastore-with-existing-sql-datasources-adding-offline-and-sync-features-in-your-application/
  3. Connecting Lambda to VQL source: https://community.denodo.com/kb/en/view/document/How%20to%20connect%20from%20an%20AWS%20Lambda%20Function%20to%20Denodo%20using%20the%20JDBC%20Driver?tag=Consumers

The third article describes creating Lambda functions to access VQL sources. Please note that, the article is a third party knowledge item and AWS does not endorse any solutions mentioned in the article, the same has been recommended on best effort basis for reference purposes only.

Having said that, in case you face further challenges, please feel free to open a support case with AWS using the following link.

AWS
SUPPORT ENGINEER
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions