使用AWS API Gateway进行API版本控制 [英] API Versioning with AWS API Gateway

查看:75
本文介绍了使用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.

这篇关于使用AWS API Gateway进行API版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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