使用AWS API Gateway进行API版本控制

问题描述:

我在使用API​​ Gateway + Lambda实现可行的版本控制方案时遇到了麻烦.我的要求是在API级别进行主要版本控制,然后在服务级别进行次要版本控制.我的环境也分散在各个帐户中,因此暂存不是环境传播的选项.有人通过AWS API Gateway成功实现了API管理吗?

I am having trouble implementing a viable versioning scenario with API Gateway + Lambda. My requirement is to have major versioning at the API level but then minor versioning at the service level. My environments are also spread across accounts so staging is not an option for env propagation. Has anyone had success implementation API management with AWS API Gateway?

在API网关中,主要版本应由单独的API表示.您可以使用自定义域功能将基本路径映射到每个API(即myapi.com/v1 => API 1,myapi.com/v2 => API 2).您还可以使用导入/导出功能来管理API之间的更改.

In API Gateway, major versions should be represented by separate APIs. You can use the custom domain feature to map base paths to each API (i.e. myapi.com/v1 => API 1, myapi.com/v2 => API 2). You can also make use of the import/export functionality to manage changes between APIs.

实际上,建议在每个环境中使用单独的帐户.我建议您仔细看一下CloudFormation来管理您的工作流程-一个CloudFormation模板可以在多个帐户中很好地工作.

Using separate accounts per environment is actually a suggested best-practice. I would suggest taking a good look at CloudFormation to manage your workflow - a single CloudFormation template would work well across multiple accounts.