How to keep AWS APPSync APIs in sync from Dev to Staging to Production?

删除回忆录丶 提交于 2019-12-24 19:13:56

问题


Let's say you have an AWS AppSync API named API-DEV. It hosts the GraphQL Schema, the Resolvers, the Data sources, DynamoDB tables (ex:Dev_Articles), DynamoDB tables configuration, and DynamoDB data. The API is consumed by approx. 50 instances of the same React app.

How would you automate the migration of newest features from API-DEV to API-STAGING? Note that I want to update everything except data.

Ways to go I'm thinking about:

  1. Keep a list of things to update, move the staging apps to maintenance mode, and manually apply the changes to staging env. Seems like a lot of work to do at every "release" and error-prone.
  2. Use some kind of YAML template in conjunction with aws-cli to store the changes in a GIT repo and automatically deploy on push. Seems like a great way to do this but couldn't find a step-by-step guide, plus, all our config is already in AWS so my guess is that we would have to recreate all using the template.
  3. Use some kind of tool that would automate compare and update from two given API and DynamoDB. Not found this yet.
  4. Build my own Nodejs app that would leverage aws-cli to compare and update. Then have this hosted on Lamda and triggered by pushes on the staging or master branches of the React app repo (Code Commit > Code Build > Code Deploy). That's where I'm heading for now, but there may be an existing solution out there.

Have any other idea? Let me know!


回答1:


Use CloudFormation to model your API. You can then maintain your API configuration, resolvers, and data sources (without data) as code and run that template in the various stages.

To simplify creation of the CloudFormation, you can use the AWS Amplify CLI to define the GraphQL schema, which will autogenerate the resolvers for you.




回答2:


Check out this: https://github.com/sid88in/serverless-appsync-plugin

Serverless-appsync-plugin makes your life easier. It should have an easier configuration than setting up your own Cloudformation.



来源:https://stackoverflow.com/questions/52278353/how-to-keep-aws-appsync-apis-in-sync-from-dev-to-staging-to-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!