I'm using CodeCommit as my repository for my code, as code-commit enables you to deploy your code to cross-accounts in another environment. I have set up a lambda function in my QA environment in the template.yaml using AWS SAM.
Where would I define the environment variables in the code pipeline so that the lambda function is can be deployed in the Prod environment in another account?
How would I define the variables so that when the staging lambda function is merged on the prod environment it takes the prod environment variables?
As it would not makes any sense to have the staging environment variables defined in the prod environment when the code is merged.
Would the environment variables be defined in the code-build?
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: CD Demo Lambda
Resources:
CDDemoLambda:
Type: 'AWS::Serverless::Function'
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.6
CodeUri: ./LambdaCode
FunctionName: ApigatewayLambda
AutoPublishAlias: ApiLambda
Description: 'Lambda function validation'
MemorySize: 128
Timeout: 30
Events:
ApiEvent:
Type: Api
Properties:
Path: /getazs
Method: get
Environment:
Variables:
CONFIG_BUCKET: staging-bucket-name
CONFIG_KEY: source-data-key-path