{"id":13626294,"url":"https://github.com/awslabs/ecs-refarch-continuous-deployment","last_synced_at":"2025-04-16T14:33:07.168Z","repository":{"id":66103526,"uuid":"61420777","full_name":"awslabs/ecs-refarch-continuous-deployment","owner":"awslabs","description":"ECS Reference Architecture for creating a flexible and scalable deployment pipeline to Amazon ECS using AWS CodePipeline","archived":true,"fork":false,"pushed_at":"2022-11-22T06:03:59.000Z","size":1843,"stargazers_count":851,"open_issues_count":13,"forks_count":996,"subscribers_count":87,"default_branch":"master","last_synced_at":"2025-03-13T02:37:50.807Z","etag":null,"topics":["aws","continuous-deployment","devops","docker","ec2","ecs","fargate"],"latest_commit_sha":null,"homepage":"https://aws.amazon.com/blogs/compute/continuous-deployment-to-amazon-ecs-using-aws-codepipeline-aws-codebuild-amazon-ecr-and-aws-cloudformation/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awslabs.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-06-18T06:38:15.000Z","updated_at":"2025-02-28T14:43:39.000Z","dependencies_parsed_at":"2023-02-23T09:30:54.736Z","dependency_job_id":null,"html_url":"https://github.com/awslabs/ecs-refarch-continuous-deployment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fecs-refarch-continuous-deployment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fecs-refarch-continuous-deployment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fecs-refarch-continuous-deployment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fecs-refarch-continuous-deployment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awslabs","download_url":"https://codeload.github.com/awslabs/ecs-refarch-continuous-deployment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249250820,"owners_count":21237961,"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","continuous-deployment","devops","docker","ec2","ecs","fargate"],"created_at":"2024-08-01T21:02:14.867Z","updated_at":"2025-04-16T14:33:06.889Z","avatar_url":"https://github.com/awslabs.png","language":"Shell","funding_links":[],"categories":["Shell","Uncategorized","Open Source Repos","Examples"],"sub_categories":["Uncategorized","Elastic Container Service"],"readme":"# ECS Reference Architecture: Continuous Deployment\n\nThe ECS Continuous Deployment reference architecture demonstrates how to achieve\n[continuous deployment][continuous-deployment] of an application to Amazon\nElastic Container Service (Amazon ECS) using AWS CodePipeline and AWS\nCodeBuild. With continuous deployment, software revisions are deployed to a\nproduction environment automatically without explicit approval from a developer,\nmaking the entire software release process automated.\n\nLaunching this AWS CloudFormation stack provisions a continuous deployment\nprocess that uses AWS CodePipeline to monitor a GitHub repository for new\ncommits and AWS CodeBuild to create a new Docker container image and to push it\ninto Amazon Elastic Container Registry (Amazon ECR).\n\nWhen creating this stack, you can opt to deploy the service onto [AWS\nFargate][fargate] or [Amazon EC2][ec2]. AWS Fargate allows you to run containers\nwithout managing clusters or services. If you choose Amazon EC2, an Auto Scaling\ngroup of t2.micro instances will be created to host your service.\n\n[![](images/architecture.png)][architecture]\n\n## Running the example\n\n#### 1. Fork the GitHub repository\n\n[Fork](https://help.github.com/articles/fork-a-repo/) the [Amazon ECS sample\napp](https://github.com/awslabs/ecs-demo-php-simple-app) GitHub repository into\nyour GitHub account.\n\nFrom your terminal application, execute the following command (make sure to\nreplace `\u003cyour_github_username\u003e` with your actual GitHub username):\n\n```console\ngit clone https://github.com/\u003cyour_github_username\u003e/ecs-demo-php-simple-app\n```\n\nThis creates a directory named `ecs-demo-php-simple-app` in your current\ndirectory, which contains the code for the Amazon ECS sample app.\n\n#### 2. Create the CloudFormation stack\n\nDeploy | Region Name | Region | Launch Types\n:---: | ------------ | ------------- | -------------\n[🚀][us-east-1] | US East (N. Virginia) | us-east-1 | Fargate, EC2\n[🚀][us-east-2] | US East (Ohio) | us-east-2 | EC2\n[🚀][us-west-1] | US West (N. California) | us-west-1 | EC2\n[🚀][us-west-2] | US West (Oregon) | us-west-2 | EC2\n[🚀][eu-west-1] | EU (Ireland) | eu-west-1 | EC2\n[🚀][eu-west-2] | EU (London) | eu-west-2 | EC2\n[🚀][eu-central-1] | EU (Frankfurt) | eu-central-1 | EC2\n[🚀][ap-southeast-1] | Asia Pacific (Singapore) | ap-southeast-1 | EC2\n[🚀][ap-southeast-2] | Asia Pacific (Sydney) | ap-southeast-2 | EC2\n[🚀][ap-northeast-1] | Asia Pacific (Tokyo) | ap-northeast-1 | EC2\n[🚀][ap-northeast-2] | Asia Pacific (Seoul) | ap-northeast-2 | EC2\n[🚀][ca-central-1] | Canada (Central) | ca-central-1 | EC2\n\nThis reference architecture can only be deployed to Regions which have all\nnecessary services available. See the [Region\nTable](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/)\nfor information about service availability.\n\nThe CloudFormation template requires the following parameters:\n\n- Cluster Configuration\n  - **Launch Type**: Deploy the service using either AWS Fargate or Amazon EC2.\n    Selecting EC2 will create an Auto Scaling group of t2.micro instances for\n    your cluster. See the [documentation][launch-types] to learn more about\n    launch types.\n\n- GitHub Configuration\n  - **Repo**: The repo name of the sample service.\n  - **Branch**: The branch of the repo to deploy continuously.\n  - **User**: Your username on GitHub.\n  - **Personal Access Token**: Token for the user specified above.\n    ([https://github.com/settings/tokens](https://github.com/settings/tokens))\n\nThe CloudFormation stack provides the following output:\n\n- **ServiceUrl**: The sample service that is being continuously deployed.\n- **PipelineUrl**: The continuous deployment pipeline in the AWS Management\n  Console.\n\n### Testing the example\n\nAfter the CloudFormation stack is created, the latest commit to the GitHub\nrepository is run through the pipeline and deployed to ECS. Open the\n**PipelineUrl** to watch the first revision run through the CodePipeline\npipeline. After the deploy step turns green, open the URL from **ServiceUrl**\nwhich loads a page similar to this:\n\n![ECS sample app](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/images/simple-php-app.png)\n\nTo test continuous deployment, make a change to src/index.php in the\necs-demo-php-simple-app repository and push it to GitHub. CodePipeline detects\nthe change, builds the new application, and deploys it to your cluster\nautomatically. After the pipeline finishes deploying the revision, reload the\npage to see the changes made.\n\n### Cleaning up the example resources\n\nTo remove all resources created by this example, do the following:\n\n1. Delete the main CloudFormation stack which deletes the substacks and resources.\n1. Manually delete resources which may contain content:\n\n    - S3 Bucket: ArtifactBucket\n    - ECR Repository: Repository\n\n## CloudFormation template resources\n\nThe following sections explains all of the resources created by the\nCloudFormation template provided with this example.\n\n#### [DeploymentPipeline](templates/deployment-pipeline.yaml)\n\n  Resources that compose the deployment pipeline include the CodeBuild project,\n  the CodePipeline pipeline, an S3 bucket for deployment artifacts, and all\n  necessary IAM roles used by those services.\n\n#### [Service](templates/service.yaml)\n\n  An ECS task definition, service, IAM role, and ECR repository for the sample\n  application. This template is used by the CodePipeline pipeline to deploy the\n  sample service continuously.\n\n#### [Cluster](templates/ecs-cluster.yaml)\n\n  An ECS cluster optionally backed by an Auto Scaling group of EC2 instances\n  running the Amazon ECS-optimized AMI for the EC2 launch type.\n\n#### [Load Balancer](templates/load-balancer.yaml)\n\n  An Application Load Balancer to be used for traffic to the sample application.\n\n#### [VPC](templates/vpc.yaml)\n\n  A VPC with two public subnets on two separate Availability Zones, an internet\n  gateway, and a route table with a default route to the public internet.\n\n## License\n\nThis reference architecture sample is [licensed][license] under Apache 2.0.\n\n[continuous-deployment]: https://aws.amazon.com/devops/continuous-delivery/\n[architecture]: images/architecture.pdf\n[license]: LICENSE\n[fargate]: https://aws.amazon.com/fargate/\n[ec2]: https://aws.amazon.com/ec2/\n[launch-types]: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html\n[us-east-1]: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=Fargate\n[us-east-2]: https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[us-west-1]: https://console.aws.amazon.com/cloudformation/home?region=us-west-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[us-west-2]: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[eu-west-1]: https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[eu-west-2]: https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[eu-central-1]: https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[ap-southeast-1]: https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[ap-southeast-2]: https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[ap-northeast-1]: https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[ap-northeast-2]: https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-2#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n[ca-central-1]: https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/create/review?stackName=ECS-ContinuousDeployment\u0026templateURL=https://s3.amazonaws.com/ecs-refarch-continuous-deployment/ecs-refarch-continuous-deployment.yaml\u0026param_LaunchType=EC2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Fecs-refarch-continuous-deployment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawslabs%2Fecs-refarch-continuous-deployment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Fecs-refarch-continuous-deployment/lists"}