{"id":20639095,"url":"https://github.com/korniichuk/ci-cd-pipeline-on-aws-for-python","last_synced_at":"2025-10-26T13:32:44.573Z","repository":{"id":45660004,"uuid":"290559304","full_name":"korniichuk/ci-cd-pipeline-on-aws-for-python","owner":"korniichuk","description":"AWS CloudFormation template for CI/CD pipeline on AWS for Python","archived":false,"fork":false,"pushed_at":"2020-08-27T16:01:03.000Z","size":1633,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T22:57:33.964Z","etag":null,"topics":["aws","aws-cloudformation","aws-codepipeline","cfn","ci-cd","cicd","cloudformation","codebuild","codecommit","codepipeline","pipeline","pipeline-as-code","pipelines","pipelines-as-code","python","python-3","python3","yaml","yml"],"latest_commit_sha":null,"homepage":"http://www.korniichuk.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/korniichuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-26T17:16:41.000Z","updated_at":"2022-07-14T13:54:26.000Z","dependencies_parsed_at":"2022-09-19T09:50:43.123Z","dependency_job_id":null,"html_url":"https://github.com/korniichuk/ci-cd-pipeline-on-aws-for-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/korniichuk/ci-cd-pipeline-on-aws-for-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fci-cd-pipeline-on-aws-for-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fci-cd-pipeline-on-aws-for-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fci-cd-pipeline-on-aws-for-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fci-cd-pipeline-on-aws-for-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/korniichuk","download_url":"https://codeload.github.com/korniichuk/ci-cd-pipeline-on-aws-for-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fci-cd-pipeline-on-aws-for-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281114524,"owners_count":26446037,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","aws-cloudformation","aws-codepipeline","cfn","ci-cd","cicd","cloudformation","codebuild","codecommit","codepipeline","pipeline","pipeline-as-code","pipelines","pipelines-as-code","python","python-3","python3","yaml","yml"],"created_at":"2024-11-16T15:22:24.165Z","updated_at":"2025-10-26T13:32:44.556Z","avatar_url":"https://github.com/korniichuk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ci-cd-pipeline-on-aws-for-python\n**Name:** ci-cd-pipeline-on-aws-for-python  \n**Description:** AWS CloudFormation template for CI/CD pipeline on AWS for Python  \n**GitHub:** https://github.com/korniichuk/ci-cd-pipeline-on-aws-for-python\n\n## Table of Contents\n* **[Intro](#intro)**\n* **[Create CI/CD pipeline. CLI](#create-cicd-pipeline-cli)**\n* **[Create CI/CD pipeline. Console](#create-cicd-pipeline-console)**\n* **[Validate created pipeline](#validate-created-pipeline)**\n* **[Sources](#sources)**\n\n## Intro\nThis repository includes AWS CloudFormation template for CI/CD pipeline on AWS for Python. CI/CD pipeline based on [AWS CodeCommit](https://aws.amazon.com/codecommit/) (à la GitHub), [AWS CodeBuild](https://aws.amazon.com/codebuild/) (à la Jenkins), and [AWS CodePipeline](https://aws.amazon.com/codepipeline/) (continuous delivery) services. You can see visualization below:\n![aws_code_services_-_mvp.jpg](img/aws_code_services_-_mvp.jpg \"AWS Code services. MVP\")\n\nCI/CD pipeline validates your Python code against coding style (aka [PEP8](https://www.python.org/dev/peps/pep-0008/)), programming errors, and [cyclomatic complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity). CI/CD pipeline runs your unit tests. Solution based on [Flake8](https://flake8.pycqa.org/en/latest/) and [Pytest](https://docs.pytest.org/en/stable/) libraries. For more details see `buildspec.yml` file in [ci_cd_pipeline_init_code_20200827.zip](https://s3-eu-west-1.amazonaws.com/korniichuk.share/code/ci_cd_pipeline_init_code_20200827.zip) archive.\n\n## Create CI/CD pipeline. CLI\nIn a terminal, we can enter the following command:\n```\n$ aws cloudformation create-stack --stack-name \u003cvalue\u003e --template-body file://\u003cvalue\u003e --capabilities CAPABILITY_NAMED_IAM\n```\n\nExample:\n```\n$ git clone https://github.com/korniichuk/ci-cd-pipeline-on-aws-for-python.git\n$ cd ci-cd-pipeline-on-aws-for-python\n$ aws cloudformation create-stack --stack-name medium --template-body file://ci_cd_pipeline.yaml --capabilities CAPABILITY_NAMED_IAM\n```\n\nExample output:\n```\n{\n    \"StackId\": \"arn:aws:cloudformation:eu-west-1:999999999999:stack/medium/4576d190-e731-11ea-925a-0ab221334260\"\n}\n```\n\n**Source:** https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html\n\n## Create CI/CD pipeline. Console\nNavigate to https://console.aws.amazon.com/cloudformation/. Click `Create stack`:\n![aws_cloudformation.png](img/aws_cloudformation.png \"AWS CloudFormation\")\n\nSelect `Upload a template file`. Click `Choose file` and select AWS CloudFormation template from your local machine (e.g. [ci_cd_pipeline.yaml](ci_cd_pipeline.yaml)):\n![aws_cloudformation_-_specify_template.png](img/aws_cloudformation_-_specify_template.png \"AWS CloudFormation. Specify template\")\n\nClick `Next`:\n![aws_cloudformation_-_specify_template_next.png](img/aws_cloudformation_-_specify_template_next.png \"AWS CloudFormation. Specify template. Next\")\n\nEnter `Stack name` (e.g. `medium`). Click `Next`:\n![aws_cloudformation_-_stack_name.png](img/aws_cloudformation_-_stack_name.png \"AWS CloudFormation. Stack name\")\n\nScroll down. Click `Next`:\n![aws_cloudformation_-_advanced_options_next.png](img/aws_cloudformation_-_advanced_options_next.png \"AWS CloudFormation. Advanced options. Next\")\n\nScroll down. Select `I acknowledge that AWS CloudFormation might create IAM resources with custom names.` checkbox. Click `Create stack`:\n![aws_cloudformation_-_create_stack.png](img/aws_cloudformation_-_create_stack.png \"AWS CloudFormation. Create stack\")\n\n## Validate created pipeline\nNavigate to https://console.aws.amazon.com/cloudformation/. Click `Stacks` and validate status of your stack:\n![aws_cloudformation_-_stacks.png](img/aws_cloudformation_-_stacks.png \"AWS CloudFormation. Stacks\")\n\nNavigate to https://console.aws.amazon.com/codepipeline/. Validate status of your pipeline:\n![aws_codepipeline_-_pipelines.png](img/aws_codepipeline_-_pipelines.png \"AWS CodePipeline. Pipelines\")\n\nNavigate to https://console.aws.amazon.com/codecommit/. Copy `URL` of your repository:\n![aws_codecommit_-_repositories.png](img/aws_codecommit_-_repositories.png \"AWS CodeCommit. Repositories\")\n\nIn a terminal, we need to enter the following command:\n```\n$ git clone URL\n$ cd demo-ci-cd-pipeline\n```\n\nWhere:\n  - `URL` -- URL of your repository from the previous step.\n\nExample:\n\n```\n$ git clone https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/demo-ci-cd-pipeline\n$ cd demo-ci-cd-pipeline\n```\n\nNext we need to change our Python code and send update to AWS CodeCommit repository. For example, you can change code of `sample.py` file to new code with typo:\n```python\n# -*- coding: utf-8 -*-\n# Name: sample\n# Version: 0.1a2\n# Owner: Ruslan Korniichuk\n\ndef hello_world():\n    return 'Hello, World1'  # Typo is here\n```\n\nCommit changes and send to remote repo:\n```\n$ git commit -am \"Test failure\"\n$ git push origin master\n```\n\nNavigate to https://console.aws.amazon.com/codepipeline/. **Wait a few minutes.** You can expect `In progress` status first:\n![aws_codepipeline_-_pipeline_in_progress.png](img/aws_codepipeline_-_pipeline_in_progress.png \"AWS CodePipeline. Pipeline in progress\")\n\nWait a few minutes more. You can expect `Failed` status:\n![aws_codepipeline_-_pipeline_failed.png](img/aws_codepipeline_-_pipeline_failed.png \"AWS CodePipeline. Pipeline failed\")\n\nSelect your pipeline and click `Details` in red `Build` block:\n![aws_codepipeline_-_build_details.png](img/aws_codepipeline_-_build_details.png \"AWS CodePipeline. Build details\")\n\nClick `Link to execution details`:\n![aws_codepipeline_-_link_to_exec_details.png](img/aws_codepipeline_-_link_to_exec_details.png \"AWS CodePipeline. Link to execution details\")\n\nFinally, you can see reason of failure. Our new Python code with typo cannot pass unit tests:\n![aws_codepipeline_-_build_failure_reason.png](img/aws_codepipeline_-_build_failure_reason.png \"AWS CodePipeline. Build failure reason\")\n\n## Sources\nhttps://github.com/aws-samples/codepipeline-nested-cfn/blob/master/codepipeline-cfn-codebuild.yml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkorniichuk%2Fci-cd-pipeline-on-aws-for-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkorniichuk%2Fci-cd-pipeline-on-aws-for-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkorniichuk%2Fci-cd-pipeline-on-aws-for-python/lists"}