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 Antwort
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
beantwortet vor 9 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen