I've seen examples of DynamoDB as the data source for AWS AppSync but I'm wondering if Aurora (specifically PostgreSQL) can be used? If yes, what would the resolvers look like for a basic example? Are there any resources that demonstrate doing this for Aurora PostgreSQL or even MySQL?
You can use the AWS Lambda resolver available in AWS AppSync to access Aurora Postgres. The code is similar to how you would access a relational database using any language. For example, you could use node-postgres with NodeJS to implement the Lambda function.
As of 2023-12-21 this is possible for Postgres in some regions (more regions will be added soon according to AWS support): https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html#data-api.enabling.modifying.all
It can not. You can use Aurora Serverless as the data source which is driven by Data API (still in beta), this allows you to configure resolvers as database queries. That being said Data API is still very slow and Aurora Serverless has a cold-start of 30sec or so as it needs to run from VPC. I would recommend avoiding production but worth playing around.
You are much better of using Lambdas as resolvers or running HTTP RestFul calls from within the resolvers.
Ignore the comments provided in the answer, no disrespect, but the comments are coming from people who never managed production at scale. The fact you have a fully manage GraphQL service at scale as well as with high-security posture will save you months of maintenance nightmares when your product(s) will reach anything close to 1MIL revenue.
You can use the AWS Lambda resolver available in AWS AppSync to access Aurora Postgres. The code is similar to how you would access a relational database using any language. For example, you could use node-postgres with NodeJS to implement the Lambda function.
yes this can be done.
Do take a look at this open-source repo that does exactly that: https://github.com/wednesday-solutions/appsync-rds-todo
As of time of writing, yes but only if it is a Serverless Aurora RDS cluster set to Postgres compatibility. The reason for this is it's the only RDS instance type that supports the Data API. Other RDS instances would have to be configured as a different data source type, most commonly Lambda.
2023-12-21; It would seem our wait is coming to an end!
We can now use Aurora Serverless v2 (Postgres only though) as an RDS resolver in AppSync.
Please note that only a few regions are supported ATM, but AWS is soon adding to all "major" regions!
© 2022 - 2024 — McMap. All rights reserved.