6-part series - (3) Create Fargate Cluster, and a Service which can access customized Docker image
Tags: docker, fargate, ecr, ecs
Published: 2023-02-15 01:15:37

In this **6-part series on configuring a CI/CD pipeline using Customized Docker image on an Apache Web Server, Application Load Balancer, ECS, ECR, CodeCommit, CodeBuild, CodeDeply services** -

In the **3rd article**, We will create Fargate Cluster, and a Service which access customized Docker image


**1st article**
- As a reference, please read my **[1st article - 6-part series - (1) Deploy a Custom Docker Image with Centos on an Apache web server and Save it to AWS ECR Repository](https://dev.to/aws-builders/6-part-series-1-deploy-a-custom-docker-image-with-centos-on-an-apache-web-server-and-save-it-to-aws-ecr-repository-186)**

**2nd article**
- As a reference, please read my **[2nd article - 6-part series - (2) Create Task Definition in ECS and Application Load balancer for the Task to be run on Fargate Cluster ](https://dev.to/aws-builders/6-part-series-2-create-task-definition-in-ecs-and-application-load-balancer-for-the-task-to-be-run-on-fargate-cluster-1ohm)**

_**Let’s get started!**_

Please visit my **[GitHub Repository for CI-CD/Docker/ECS/ECR articles](https://github.com/awsmine/Docker_projects)** on various topics being updated on constant basis.

# Objectives:

**1.** Create Cluster

**2.** Create service

**3.** Edit and Check LB Security groups

**4.** Test the DNS - Access the image from the web browser

# Pre-requisites:
- AWS user account with admin access, not a root account.
- AWS CLI.

# Resources Used:

**[Amazon Elastic Container Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html)**

**[AWS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/userguide/what-is-fargate.html)**

# Steps for implementation to this project:

## 1. Create Cluster

- **`On Elastic Container Service, Clusters, Create Cluster, my_cluster, default vpc, 2 Public subnets - us-east-1a and us-east-1b`**

- Create


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dq412hke6w3aoafmlsq2.png)


## 2. Create service

- **`On Amazon Elastic Container Service, click my_cluster, Under Services, click Create, my_cluster is already selected, Launch_type, FARGATE, Platform version - LATEST, Service, Family - my_task REVISION - (2) LATEST, my_service, Desired tasks, 2, under Networking, default vpc, choose 2 Public subnets us-east-1a and us-east-1b, use an existing sg - defaultSG, Public IP - turnend on`**

- **`Load balancing, Application LB, use an existing lb, my-alb, my_container 80:80, use an existing listener, listener, 80:HTTP
create a new target group, new-tg, HTTP, Path pattern - /*, evaluation order - 1, Health check path - /, ch ek protocol - HTTP, time - 30 sec`**


- Create

**2 Tasks Running**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6prnzujaf1zlw8okawl7.png)


## 3. Edit and Check LB Security groups

- Load Balancer Security Groups

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yg9yvu2ew9nj7fzmrllb.png)


## 4. Test the DNS - Access the image from the web browser

-**`Copy the load balancer DNS name and paste it in the browser tab.`**

**You should be able to see the HTML page**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pbdwapw81ou91c69q7n8.png)


# What we have done so far

- We have successfully created a Fargate Cluster, and a Service which access customized Docker image from the browser.