This content originally appeared on DEV Community and was authored by Pragnesh Patel
Building on Day 7, today: Task definitions—the blueprint for containers.
Key Parameters
- Container definitions: Image, ports, CPU/memory.
- Volumes, networking, etc.
Step 1: Create Task Definition
JSON example for our app:
{
"family": "my-task",
"containerDefinitions": [
{
"name": "my-container",
"image": "<account-id>.dkr.ecr.us-west-2.amazonaws.com/my-app-repo:latest",
"cpu": 256,
"memory": 512,
"portMappings": [{ "containerPort": 3000, "hostPort": 3000 }],
"essential": true
}
],
"requiresCompatibilities": ["FARGATE"],
"networkMode": "awsvpc",
"cpu": "256",
"memory": "512"
}
Register via CLI: aws ecs register-task-definition --cli-input-json file://task.json
Step 2: Run a Task
Console: ECS > Clusters > my-cluster > Tasks > Run new task > Select definition.
CLI:
aws ecs run-task --cluster my-cluster --task-definition my-task --launch-type FARGATE --network-configuration "awsvpcConfiguration={subnets=[subnet-id],securityGroups=[sg-id],assignPublicIp=ENABLED}"
Check logs in console.
Today’s Takeaway
Tasks defined and running!
What’s Next?
In Day 9, we’ll deploy ECS services.
This content originally appeared on DEV Community and was authored by Pragnesh Patel

Pragnesh Patel | Sciencx (2025-08-18T04:42:21+00:00) Day 8: ECS Task Definitions: Defining Your Containers. Retrieved from https://www.scien.cx/2025/08/18/day-8-ecs-task-definitions-defining-your-containers/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.