问题描述
我有一个设置,我使用 CodeCommit 作为我的存储库来存储 lambda 函数和 CodePipeline 使用 AWS SAM 来部署和创建 lambda 函数。
我想将 lambda 函数部署到不同的环境中,例如 QA、staging 和 Prod。我已使用 AWS 参数存储来引用我的变量。
下面是我设置的 template.yaml 文件,它创建了一个 lambda 函数,它使用 AWS 参数存储来引用变量
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Test
Parameters:
BucketName:
Description: 'Required. Bucket Name'
Type: 'AWS::SSM::Parameter::Value<String>'
Default: 'MyBucketname'
CSVPath:
Description: 'Required. Configkey Name'
Type: 'AWS::SSM::Parameter::Value<String>'
Default: 'MyCSVPath'
Resources:
GetOrdersFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./LambdaCode
Handler: app.lambda_handler
FunctionName: app
Runtime: python3.6
Description: 'staging'
Environment:
Variables:
BucketName: !Ref BucketName
CSVPath: !Ref CSVPath
Events:
HelloWorld:
Type: Api
Properties:
Path: /orders
Method: get
我可以在我的 template.yaml 中定义变量以进行部署,但我不确定如何为不同的环境(prod 或 qa)定义它。
当管道触发时,它应该使用 QA 变量部署到 QA 环境,并使用将在 AWS Parameter Store 中定义的 prod 变量部署到 prod
我应该在我的 template.yaml 文件中进行哪些更改才能部署到不同的环境?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)