Port Mappings from environment variables in AWS ECS Task Definition

467 Views Asked by At

Is there a way to specify container port from environment variable in AWS ECS Task Definition?

This is in my task-definition.json which is used by Github Actions

"containerDefinitions": [
    {
        "portMappings": [
            {
                "containerPort": 3037  <=== Can this come from environment variable defined below?
            }
        ],
        "essential": true,
        "environment": [
            {
                "name": "PORT",
                "value": "3037"
            }
        ]
    }
],
"requiresCompatibilities": ["EC2"]
0

There are 0 best solutions below