首页 > 解决方案 > How to keep AWS APPSync APIs in sync from Dev to Staging to Production?

问题描述

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!

标签: amazon-web-servicescontinuous-integrationamazon-dynamodbcontinuous-deliveryaws-appsync

解决方案


使用CloudFormation 为您的 API 建模。然后,您可以将 API 配置、解析器和数据源(无数据)维护为代码,并在各个阶段运行该模板。

为了简化 CloudFormation 的创建,您可以使用AWS Amplify CLI定义 GraphQL 架构,该架构将为您自动生成解析器。


推荐阅读