How to Use CodeBuild and CodeDeploy to Deploy Lambda to Different Environments

1

Hi, I have a very simple C# Lambda that I will execute from a schedule. I want to use CodeBuild and CodeDeploy to be able to deploy new versions of this to either my staging or production environments. At the moment, my CodeBuild project build does the following:

  • Builds the Lambda c# project
  • Pushes the code to the Lambda $latest version
  • Creates a new Lambda version
  • Updates (string replacement) my Lambda deployment appspec.yml file to have the correct 'currentversion' and 'targetversion' based on what the current versions are.
  • uploads the appspec to an S3 bucket so that I can use it later in CodeDeploy.

My CodeDeploy just takes the appspec.yml file and executes it which then changes the $latest version of the Lambda to the new version.

Thats all good (I think) except that my CodeBuild doesn't know where I want to deploy the change to (staging or production) so should I be uploading 2 sets of code (one targeting a 'stage' Lambda alias and the other targeting a 'production' Lambda alias)? Or should there be a separate CodeBuild project for each environment? Or should I be having a completely separate Lambda (instead of using aliases) where one is for staging and the other for production? I feel like I am doing something horribly wrong here :)

질문됨 2년 전158회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠