Issue with codepipeline and CDK for lambda deployment

0

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 Answer
0

Hello,

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

build:
    commands:
      - echo "Building the Docker image....."
      - docker build -t app/<app_name> .
      - docker tag app/<app_name> <aws_acct_id>.dkr.ecr.<aws_region>.amazonaws.com/app/<app_name>$COMMIT_SHA
      - docker push <aws_acct_id>.dkr.ecr.<aws_region>.amazonaws.com/app/<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.

HTH

profile picture
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions