Before working with Amazon ECS in the AWS Console, visit Docker Hub and review the two images that form the basis of our demo projects. These public repositories—available at kodekloud.com/ecs-project1 and kodekloud.com/ecs-project2—contain the project images we will use.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.

Project One Overview
Project One uses a simple Node.js application powered by an Express server. When a GET request is sent to the root path, the server responds with a basic HTML file. Below is the HTML file delivered by the application:Note that the Express server listens on port 3000.
Setting Up ECS Using the AWS Console
Quick Start with ECS
- Log in to the AWS Console, search for “ECS”, and select Elastic Container Service.
- If you’re new to ECS, a quick start wizard will guide you. Although sample applications are available, select the custom option to configure your container manually.
- In the container configuration:
- Container Name: For example, “ECS-Project1”.
- Image: Use “KodeKloud/ECS-Project1”. If your image resides in a private repository, provide your credentials; otherwise, leave it as is.
- Port Mapping: Set to 3000/TCP to match the Express application.
Defining Your ECS Service
After setting up the container:- Service Name: For instance, “ECS-project1-service”.
- Load Balancer: Optionally add one—select “none” for now.

Understanding the ECS Task Wizard Components
1. Task Definitions
Task definitions store all container configurations, including port mappings, volumes, and environment variables. Revision numbers help track changes, with the latest revision reflecting the current configuration.
2. Cluster
The ECS cluster represents the infrastructure—whether EC2 instances when using the EC2 launch type, or a managed Fargate environment. The default cluster, set up by the wizard, includes a newly created VPC and subnets.
3. Service and Tasks
The service, “ECS-project1-service”, is created with a desired task count (initially one). You can inspect network settings, including VPC, subnets, and security groups. The running task receives a public IP address which you can use to access the deployed application.

Cleaning Up the Quick Start Environment
After verification, delete the environment created by the quick start wizard in order to redeploy from scratch:- In your cluster, select the service and delete it. Confirm with “delete me.” Ensure that all tasks are removed.
- Delete the cluster.

Creating a New ECS Cluster
- In the ECS Console, click Create Cluster.
- Choose Networking only if using Fargate. (For EC2, you can choose between Linux and Windows options.)
- Name your cluster (for example, “cluster1”) and create a new VPC with default CIDR and subnet settings.
- Click Create.


Creating Task Definitions for Your New Cluster
- Navigate to Task Definitions and click Create new Task Definition.
- Select Fargate as the launch type.
- Name the task definition (e.g., “ECS-Project1”) and assign the appropriate task execution role.
- Choose Linux as the operating system and allocate modest CPU and memory resources for the demo.
- Add a container:
- Container Name: (e.g., “node app”)
- Image: Use “KodeKloud/ECS-Project1”
- Port Mapping: Set to 3000

Creating the ECS Service
- In your new cluster (“cluster1”), go to the Services tab and click Create Service.
- Configure the following:
- Launch Type: Fargate
- Operating System: Linux
- Task Definition: Select “ECS-Project1” (latest revision)
- Service Name: (e.g., “project1-service”)
- Number of Tasks: For demonstration purposes, choose 2 tasks.
- Set up networking:
- Select the VPC created earlier.
- Choose the appropriate subnets.
- Configure the security group: Change the default setting (typically allowing traffic on port 80) to allow Custom TCP traffic on port 3000 from anywhere.

- Proceed without a load balancer by selecting No load balancer (this will be discussed later).
- Optionally configure auto scaling, then click Next to review all configurations.
- Finally, click Create Service.



Updating Your Application
Suppose you modify the HTML file by adding extra exclamation marks to the H1 tag. The updated HTML might look like this:


Final Notes
This demonstration has shown how to deploy and update a basic application on ECS using both the quick start wizard and manual configuration. Although each ECS task gets a unique IP address, a load balancer is recommended for production to provide a single, stable endpoint and to manage IP changes seamlessly. After completing the demo, remember to delete the entire service before moving to more complex environments that involve databases, volumes, and load balancing.
This guide detailed the process of setting up, deploying, updating, and cleaning up an ECS-based application. For production-grade deployments, always consider integrating a load balancer to manage traffic effectively.