如何使用SAM到SPESIFIC阶段部署到AWS而不影响其他阶段?
我希望能够在不影响其他阶段的情况下部署到想要的阶段,例如,我想一直部署DEV,然后将其部署到prod,而不会影响开发阶段,
Resources:
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
EndpointConfiguration: REGIONAL
StageName: Dev
OpenApiVersion: "3.0"
Name: asaf_api_second
Description: "my api from sam"
如果我更改stagename来制作阶段dev dev会删除,我该如何预防?
I want to be able to deploy to which stage I want without affecting other stages, for example, I want to deploy all the time to dev, and then deploy to prod without effect the dev stage
Resources:
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
EndpointConfiguration: REGIONAL
StageName: Dev
OpenApiVersion: "3.0"
Name: asaf_api_second
Description: "my api from sam"
if I change the StageName to Prod the stage Dev will delete, how can I prevent that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所需的解决方案包括以下步骤:
您需要将阶段定义为根级别的参数:
在资源定义中使用(!ref)添加(!ref)的参考文献:
:
要部署到prod时,使用CLI或TOML文件中的部署命令中覆盖所需的阶段参数:
The required solution includes the following steps:
You will need to define the stage as a parameter in the root level:
Add a reference using (!Ref) to the stage parameter name in the resource definition:
When you want to deploy to prod, override the required stage parameter in the deploy command using cli or in the toml file: