如何使AWS APPSync API从Dev到Staging到Production保持同步? [英] How to keep AWS APPSync APIs in sync from Dev to Staging to Production?

本文介绍了如何使AWS APPSync API从Dev到Staging到Production保持同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您有一个名为 API-DEV AWS AppSync API
它承载GraphQL架构,解析器,数据源,DynamoDB表(例如: Dev_Articles ),DynamoDB表配置和DynamoDB数据。该API大约消耗了。同一React应用程序的50个实例。

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.

您如何自动将最新功能从 API-DEV 迁移到 API标记?请注意,我想更新除数据以外的所有内容。

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

我要考虑的方法:


  1. 保留要更新的内容的列表,将登台应用程序移至维护模式,然后将更改手动应用于登台环境。似乎在每个发行版上都需要做很多工作,并且容易出错。

  2. 结合使用某种YAML模板和 aws-cli 将更改存储在GIT存储库中,并在推送时自动部署。似乎是执行此操作的好方法,但找不到分步指南,此外,我们的所有配置都已在AWS中,因此我想我们必须使用模板重新创建所有内容。

  3. 使用某种工具可以自动比较和更新两个给定的API和DynamoDB。

  4. 构建自己的Nodejs应用,该应用将利用 aws-cli 进行比较和更新。然后将其托管在 Lamda 上,并通过推动以下分支的 staging master 分支触发React应用程序仓库(代码提交>代码构建>代码部署)。那就是我现在要去的地方,但是那里可能有一个现有的解决方案。

  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!

推荐答案

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

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.

为简化CloudFormation的创建,您可以使用 AWS放大CLI 定义GraphQL模式,它将为您自动生成解析器。

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.

这篇关于如何使AWS APPSync API从Dev到Staging到Production保持同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆