Bird
0
0

You have this ECS task definition snippet:

medium📝 Debug Q14 of 15
AWS - ECS and Fargate
You have this ECS task definition snippet:
{
  "containerDefinitions": [{
    "name": "app",
    "image": "myapp:latest",
    "cpu": 512,
    "memory": 1024
  }]
}

When you try to run this task, it fails with an error about missing port mappings. What is the likely fix?
AAdd a portMappings section specifying containerPort and hostPort
BRemove the cpu and memory fields
CChange the image name to include a registry URL
DRename the container from 'app' to 'web'
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error about missing port mappings

    If the app requires network access, port mappings must be defined to expose ports.
  2. Step 2: Identify the fix

    Adding a portMappings section with containerPort and hostPort will resolve the error by exposing the needed ports.
  3. Final Answer:

    Add a portMappings section specifying containerPort and hostPort -> Option A
  4. Quick Check:

    Missing ports error = add portMappings [OK]
Quick Trick: Add portMappings to expose container ports when needed [OK]
Common Mistakes:
  • Removing CPU or memory which are unrelated to port errors
  • Changing image name unnecessarily
  • Renaming container without fixing ports

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes