DevOps is the combination of cultural philosophies, practices, and tools that increases an organization’s ability to deliver applications and services at high velocity: evolving and improving products at a faster pace than organizations using traditional software development and infrastructure management processes. This speed enables organizations to better serve their customers and compete more effectively in the market.
• AWS CodePipeline is a DevOps service for Continuous Integration, Continuous Delivery and Continuous Deployment of applications hosted on various AWS platforms.
• Amazon Elastic Container Service (ECS) is an AWS managed service for containerized applications for Docker containers.
• Amazon Fargate is a serverless launch type for Amazon Elastic Container Service (ECS).
• For the example application deployed to ECS, an AWS CodePipeline consists of a source code repository such as a GitHub repo, AWS CodeBuild for Build and an AWS ECS (Fargate) service for Staging.
• The benefit of using an AWS CodePipeline for an AWS ECS service is that the ECS service continues to run while a new Docker image is built and deployed.
Docker containers may be deployed using one of the several cloud platforms, Amazon Elastic Container Service (ECS) being one of them. ECS provides the Fargate launch type, which is a serverless platform with which a container service is run on Docker containers instead of EC2 instances.
A Docker container deployment may need to be updated or modified due to changes in the Docker image source code or code build. Any modifications in the source code for a Docker image would require that a Docker image be rebuilt and the Docker service be redeployed. Without a mechanism to integrate, build, deliver and deploy source code while an AWS ECS deployment is running, it would involve stopping the ECS service tasks and as a result, incurring downtime for an ECS service. High availability of an ECS service being a priority, stopping tasks to redeploy an application is not a suitable option.
AWS CodePipeline is a DevOps service for Continuous Integration, Continuous Delivery and Continuous Deployment of applications hosted on the various AWS platforms, including Amazon ECS and Fargate as a deployment platform. An ECS service may be updated or modified without stopping the ECS service tasks. AWS CodePipeline provides high availability of an ECS service in a dynamic environment in which source code changes for a Docker image are common. A CodePipeline consists of three phases: Source code integration, Source code build, and Deployment, as shown in
Figure 1. CodePipeline Phases
For source code we shall use a Github repository. For source code build we shall use a AWS CodeBuild project. For deployment we shall use an ECS service of launch type Fargate.
Creating and deploying a CodePipeline application to ECS Fargate involves the following procedure:
1. Create an ECS Fargate Task Definition an Service
2. Configure connectivity on Task Subnet/s
3. Create or Configure a S3 Bucket for Output Artifacts from the CodePipeline Build Stage
4. Create a CodePipeline to deploy a Docker platform application (image) on ECS Fargate
5. Modify Input/Output Settings for Stage Artifacts
6. Run the CodePipeline
7. Make source code modifications to re-run CodePipeline
Setting the Environment
Adding a Build Spec for CodeBuild Project
Adding an Image Definitions File
Creating a Task Definition
Configuring Connectivity in Task Subnets
Before creating a service we need to configure connectivity to the Internet in the Subnets to be used when configuring the service. The Route Table lists the routes. We need to add a route with a default Internet gateway. Add a route with Destination as 0.0.0.0/0, which is an IP address. Select Target as an internet gateway.
Creating and Testing the Container Service
Next, create an ECS container service in the default cluster as shown in Figure 3.
Figure 3. Cluster with 1 Service
With Fargate launch type an Elastic Network Interface (ENI) is provisioned for each task.
Copy the Public IP of the task, which is the same as the Public IP of the Elastic Network Interface, from either the task Details page Network section or the ENI Console. Open the URL
Recommend to Read