{"id":25871117,"url":"https://github.com/kavithma-thushal/ci-cd-pipelines","last_synced_at":"2026-04-13T17:02:28.414Z","repository":{"id":280220168,"uuid":"941333826","full_name":"Kavithma-Thushal/CI-CD-Pipelines","owner":"Kavithma-Thushal","description":"This is learning about CI-CD Pipelines in IJSE.","archived":false,"fork":false,"pushed_at":"2025-03-27T03:19:59.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T03:25:18.438Z","etag":null,"topics":["aws","ecr","ecs","flask","github","load-balancer","python"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kavithma-Thushal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-02T03:20:10.000Z","updated_at":"2025-03-27T03:20:02.000Z","dependencies_parsed_at":"2025-03-02T04:23:34.634Z","dependency_job_id":"ff1addc6-0a94-4c47-b9a8-39fc58758981","html_url":"https://github.com/Kavithma-Thushal/CI-CD-Pipelines","commit_stats":null,"previous_names":["kavithma-thushal/ci-cd-pipelines"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kavithma-Thushal/CI-CD-Pipelines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavithma-Thushal%2FCI-CD-Pipelines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavithma-Thushal%2FCI-CD-Pipelines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavithma-Thushal%2FCI-CD-Pipelines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavithma-Thushal%2FCI-CD-Pipelines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kavithma-Thushal","download_url":"https://codeload.github.com/Kavithma-Thushal/CI-CD-Pipelines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kavithma-Thushal%2FCI-CD-Pipelines/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260081968,"owners_count":22956221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","ecr","ecs","flask","github","load-balancer","python"],"created_at":"2025-03-02T06:35:28.618Z","updated_at":"2026-04-13T17:02:28.408Z","avatar_url":"https://github.com/Kavithma-Thushal.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"CI/CD Pipeline using ECR, GitHub, ECS, CodePipeline, and Load Balancer\n\n## Build Docker Image = `docker build -t demo .`\n\n## Run Docker Image = `docker run -p 80:80 demo`\n\n# Step 1: Create Required Repositories in ECR\n\nInstall AWS CLI: Download and install the AWS CLI from \u003chttps://aws.amazon.com/cli/\u003e.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image001.png?raw=true)\n\nConfigure AWS CLI: Create an IAM user or get the access key and secret key for the root user. Run the following command\nand enter your AWS credentials:  \naws configure\n\nCreate ECR Repository: Navigate to the AWS Management Console. Open the Amazon ECR console. Create a new repository to\nstore your Docker images.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image002.png?raw=true)\n\nAuthenticate Docker to ECR: Get the login command from the ECR console and run it in your terminal:\n\naws configure\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image005.png?raw=true)\n\naws ecr get-login-password --region region | docker login --username AWS --password-stdin\naws_account_id.dkr.ecr.region.amazonaws.com\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image007.png?raw=true)\n\n# Step 2: Build and Push Docker Image\n\nBuild Docker Image: Build your Docker image using the Dockerfile.  \ndocker build -t your-image-name .\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image008.png?raw=true)\n\nTag Docker Image: Tag the Docker image with your ECR repository URI.  \ndocker tag your-image-name:latest aws_account_id.dkr.ecr.region.amazonaws.com/your-repo-name:latest\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image011.png?raw=true)\n\nPush Docker Image to ECR: Push the tagged image to the ECR repository.  \ndocker push aws_account_id.dkr.ecr.region.amazonaws.com/your-repo-name:latest\n\n# Step 3: Set Up GitHub Repository\n\nInitialize GitHub Repository: Initialize a Git repository and add your remote GitHub repository.  \ngit init  \ngit remote add origin \u003chttps://github.com/your-username/your-repo-name.git\u003e\n\nCreate Branches: Create the following branches:  \ngit checkout -b develop  \ngit checkout -b pre-develop  \ngit checkout -b release\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image012.png?raw=true)\n\nEnable Branch Protection Rules: Go to your GitHub repository settings and set up branch protection rules.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image013.png?raw=true)\n\n# Step 4: Configure AWS CodePipeline\n\nCreate a Pipeline: Open the AWS CodePipeline console and create a new pipeline. Provide a pipeline name and select the\nservice role.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image014.png?raw=true)\n\nAdd Source Stage: Select GitHub (Version 2) as the source provider and connect your GitHub repository. Select the\nrepository and branch (e.g., release).\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image015.png?raw=true)\n\nClick connect to GitHub(Version 2) if you don’t have a project click Connect to GitHub\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image016.png?raw=true)\n\nProvide a connection name and click on Connect to GitHub.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image017.png?raw=true)\n\nProvide the required Authorization\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image019.png?raw=true)\n\nSelect the required repositories and click install\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image020.png?raw=true)\n\nApprove it your GitHub ID will be displayed click connect\n\nWhen you complete the above task your github id will be displayed in the pipeline.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image022.png?raw=true)\n\nSelect the Repository and Branch\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image024.png?raw=true)\n\nUpdate the trigger\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image025.png?raw=true)\n\nOutput artifact format\n\nSelect code pipeline default\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image026.png?raw=true)\n\nAdd Build Stage: Select AWS CodeBuild as the build provider. Create a new build project and configure it to use the\nbuildspec.yaml file from your repository.\n\nselect code build.\n\nCreate a new project by clicking the create project button.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image027.png?raw=true)\n\nProvide a project name\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image028.png?raw=true)\n\nProvide a role name\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image029.png?raw=true)\n\nSelect buildspec file and click continue to code pipeline\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image030.png?raw=true)\n\nSelect the project and click next\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image031.png?raw=true)\n\nTill we create ECS skip the deployment stage.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image032.png?raw=true)\n\nClick on Skip\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image033.png?raw=true)\n\nThe build will fail due to newly created IAM user doesn’t have the required permissions.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image034.png?raw=true)\n\nClick on view details to view.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image035.png?raw=true)\n\nTo find the IAM role go to Build details and click on Service role\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image037.png?raw=true)\n\nClick on add permissions\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image038.png?raw=true)\n\nAdd the EC2InstanceProfileForImageBuilderECRContainerBuilds. Add the required permission to the user\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image039.png?raw=true)\n\nGo back to the release pipeline and click release change\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image040.png?raw=true)\n\nClick on Release\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image041.png?raw=true)\n\nThe build will succeed.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image042.png?raw=true)\n\n# Step 5: Set Up CodeBuild\n\nCreate Build Project: Provide a project name and select the build environment. Specify the buildspec file:  \n\\`\\`\\`yaml  \nversion: 0.2  \nphases:  \ninstall:  \nruntime-versions:  \ndocker: 18  \npre_build:  \ncommands:  \n\\- $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION)  \nbuild:  \ncommands:  \n\\- docker build -t your-image-name .  \n\\- docker tag your-image-name:latest aws_account_id.dkr.ecr.region.amazonaws.com/your-repo-name:latest  \npost_build:  \ncommands:  \n\\- docker push aws_account_id.dkr.ecr.region.amazonaws.com/your-repo-name:latest\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image046.png?raw=true)\n\n# Step 6: Create ECS Cluster and Task Definition\n\nCreate ECS Cluster: Open the ECS console and create a new cluster with Fargate (serverless) launch type.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image047.png?raw=true)\n\nSelect Fargate (serverless) application.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image048.png?raw=true)\n\nClick Create button\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image049.png?raw=true)\n\nCreate Task Definition: Define the task definition with container details, environment variables, and resource\nrequirements.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image050.png?raw=true)\n\nContainer details\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image051.png?raw=true)\n\nAdd environment file and variables according to the requirement\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image052.png?raw=true)\n\nCreate Service\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image053.png?raw=true)\n\nFill the family and Task Definition revision version\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image054.png?raw=true)\n\nUpdate the networking requirements.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image055.png?raw=true)\n\n# Step 7: Configure Load Balancer\n\nCreate Load Balancer: Open the EC2 console and create a new load balancer. Configure the load balancer to direct traffic\nto the ECS service.\n\nSelect the correct VPC and subnets and Security groups.\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image056.png?raw=true)\n\nClick on create button\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image057.png?raw=true)\n\nGo to Configuration and networking\n\nGet the DNS from the network configuration\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image058.png?raw=true)\n\n# Step 8: Deploy to ECS\n\nCreate ECS Service: Create a new service in the ECS console using the task definition. Configure the service to use the\nload balancer.\n\nUpdate CodePipeline: Add a deploy stage to your pipeline, specifying ECS as the deployment provider. Select the ECS\ncluster and service created earlier.\n\nFor the deployment go back to pipelines and update the pipeline.\n\nImage definitions file should be taken from the buildspec.yaml from the codebase\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image059.png?raw=true)\n\nClick next\n\n![alt text](https://github.com/malindrarodrigo/IJSE-ai/blob/main/CI_CD_Pipeline_Tutorial_files/image060.png?raw=true)\n\n# Advantages of CI/CD Pipeline\n\n- Automation: Automates the entire build, test, and deployment process, reducing manual intervention and errors.\n- Consistency: Ensures consistent deployment processes across environments.\n- Speed: Accelerates the release cycle, enabling quicker updates and faster time-to-market.\n- Scalability: Easily scales to handle increased load and larger codebases.\n\n# Further Improvements\n\n- Testing: Integrate automated testing (unit, integration, and end-to-end tests) into the pipeline.\n- Monitoring: Add monitoring and logging to track the performance and health of applications.\n- Security: Implement security checks and vulnerability scanning in the pipeline.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavithma-thushal%2Fci-cd-pipelines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavithma-thushal%2Fci-cd-pipelines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavithma-thushal%2Fci-cd-pipelines/lists"}