Issue with codepipeline and CDK for lambda deployment


Hi team, I am trying to build CI/CD codepipeline for lambda deployment using CDK. In this pipeline, I've create source and codebuild stage. In codebuild stage, I am building and pushing docker image to ECR repository which is attached to lambda. After build stage, I want to create code deploy stage which should deploy latest ecr image tag in lambda. But lambda function is created in a pipeline named as "provision-infra", this "provision-infra" build all stacks including codepipeline for lambda deployment.

I tried to create lambdaDeploymentGroup but not able to see a way to trigger codedeploy stage.

1개 답변


I've seen this kind of setup/arrangements handled in the Codebuild/Buildspec step itself

i.e. Add the build, deploy, and package steps in the Build command of the buildspec.yml file

      - echo "Building the Docker image....."
      - docker build -t app/<app_name> .
      - docker tag app/<app_name> <aws_acct_id>.dkr.ecr.<aws_region><app_name>$COMMIT_SHA
      - docker push <aws_acct_id>.dkr.ecr.<aws_region><app_name>$COMMIT_SHA
      - echo "Build finished and image pushed on `date`"

You can then use the latest SHA/Tag of the ECR image to update lambda deployment.


profile picture
답변함 일 년 전

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

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

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

관련 콘텐츠