Set up Fargate pipeline using cdk code in separate github repositories

0

Is there a way to set up CI/CD pipeline for ECS + Fargate service using CDK, In a way that container code lives in one separate GitHub repository and CDK code in another GitHub repository?

3 Answers
0

I think we need to create two pipelines.
One for ECS + Fargate resources, the other for container code.

profile picture
EXPERT
answered a year ago
0

Hi, yes.

One code pipeline will be responsible for infrastructure as code. I personally used this guide for provisioning a Fargate cluster fronted by an application load balancer: https://docs.aws.amazon.com/cdk/v2/guide/ecs_example.html

In particular, the ApplicationLoadBalancedFargateService allows you to specify an image coming from an ECR repository.

You could have another pipeline that push docker images on ECR via code build and code deploy.

A partial example of above can be found here: https://github.com/aws-samples/amazon-ecs-fargate-cdk-v2-cicd

Hope it inspires ;)

profile picture
EXPERT
answered a year ago
0

You can do this by creating two separate pipelines:

  1. The application code pipeline. This pipeline will reference a repository (Github, CodeCommit, etc) that will host your application code. Upon pushing a change to the main branch, the pipeline will be triggered. You can then run through linting, formatting, unit tests etc. Once that is completed, you can build your docker container and push that to a registry.
  2. The infrastructure pipeline. This pipeline will reference a repository that contains the CDK code. Upon pushing a change, you can run through similar building/testing stages as in the first pipeline and change the architecture in pre-prod environments to ensure it works as expected, then promote to production when ready.
profile pictureAWS
answered a year 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