I have been trying to wrap my head around this for a while now. I have my MySQL instance in RDS and I have tried to to add it as a datasource
with amplify api add-graphql-datasource
however I get an error:
hutber@hutber:/var/www/unsal.co.uk$ amplify api add-graphql-datasource
Using datasource: Aurora Serverless, provided by: awscloudformation
? Provide the region in which your cluster is located: eu-west-2
No properly configured Aurora Serverless clusters found.
TypeError: Cannot destructure property 'selectedClusterArn' of '(intermediate value)' as it is undefined.
at serviceWalkthrough (/home/hutber/.nvm/versions/node/v13.8.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-api/src/provider-utils/awscloudformation/service-walkthroughs/appSync-rds-walkthrough.js:55:11)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Object.executeAmplifyCommand (/home/hutber/.nvm/versions/node/v13.8.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-api/src/index.ts:188:3)
at executePluginModuleCommand (/home/hutber/.nvm/versions/node/v13.8.0/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:161:3)
at Object.executeCommand (/home/hutber/.nvm/versions/node/v13.8.0/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:26:5)
at Object.run (/home/hutber/.nvm/versions/node/v13.8.0/lib/node_modules/@aws-amplify/cli/src/index.ts:86:5)
This makes me think, I am doing it wrong way? Is this how you would normally add MySQL to app-sync?
The issue was that when creating your secret inside your secrets manager, your username and password in this need to match exactly what you have on your db/username and password.
This was not clear to me that this user name and password were that of the db. So now, everything works and I have added the MySQL datastore.
Now I have to work out how to use it :P