Recommended reading:
1. Create an ECS cluster (Fargate)
Open the Amazon Elastic Container Service console, go to the left panel and select Clusters, then choose Create cluster. Choose the Fargate option so AWS manages the underlying compute and you only manage the tasks and task definitions. Give the cluster a clear name, for exampledemo-cluster.

If you see an “unable to assume the service-linked role” error on first cluster creation, retry creating the cluster. AWS will then create the required ECS service-linked role and the issue will not recur.
2. Create a Fargate task definition
From the left panel choose Task Definitions → Create new task definition. Enter a name such asDemoTaskDefinition and select the AWS Fargate launch type under Infrastructure requirements.

ecsTaskExecutionRole) allows ECS to pull images and publish logs; the task role is used if your application needs to call AWS APIs.

- Name:
demo-container - Image: use the public Apache HTTP Server image for this demo
- Container port: 80 (protocol TCP, app protocol HTTP)
- Leave “Essential” enabled and other advanced options at defaults for the demo.


3. Create a service (keep tasks running across AZs)
In the Cluster view select Create → Create Service. Choose the task definition family you created and an optional revision. Name the service, for exampleDemoService.


- Set Desired tasks to
2so ECS will maintain two running copies. - Networking: select your default VPC and choose subnets that span different Availability Zones. For two desired tasks, select two subnets in two different AZs (for example
us-east-2aandus-east-2b). For three tasks choose three AZ subnets.

0.0.0.0/0, but do so only for non-production testing.
Allowing HTTP (port 80) from 0.0.0.0/0 exposes the service to the public internet. For production use, restrict access with specific IP ranges, a load balancer with proper security controls, or other network controls.
- Selecting subnets across multiple AZs improves resilience and placement, but does not automatically make tasks reachable from the internet.
- To expose tasks publicly: enable auto-assign public IP when placing tasks into public subnets, or (recommended) put the service behind a public-facing load balancer and configure listeners/target groups.
4. Cleanup
When finished, remove resources to avoid ongoing charges:- Stop or delete the service from within the cluster—the service will drain and stop tasks.
- Delete the cluster from the Clusters page (you will be asked to type the cluster name to confirm).

- Deregister task definition revisions you no longer need from the Task Definitions page; deregistered revisions won’t be available for new deployments. Refresh the Task Definitions view to confirm removal.

Quick reference
Links and references
- Amazon ECS documentation
- AWS Fargate overview
- AWS Public ECR registry (gallery)
- AWS CloudWatch
- Amazon EC2 security groups documentation