Error: Invalid type for parameter, json, in aws cli command

Viewed 42

I am creating a task-definition using aws cli that I am running in a Windows batch-file, and have to input both containerPort and Hostport:

set name=task_definition_1
set ecs_role_arn=arn:aws:iam::913879294690:role/ecsTaskExecutionRole
set container_name=container_1
set container_uri=913879294690.dkr.ecr.us-east-1.amazonaws.com/sample-containers:resume_ranking

aws ecs register-task-definition --family %name% --task-role-arn %ecs_role_arn% --execution-role-arn %ecs_role_arn% --container-definitions name=%container_name%,image=%container_uri%,memory=128,portMappings={containerPort=7000,hostPort=7000}

At the end of the last line of code, I am trying to input:

portMappings={containerPort=7000,hostPort=7000}

This is the output I receive:

Parameter validation failed:
Invalid type for parameter containerDefinitions[0].portMappings[0].containerPort, value: 7000, type: <class 'str'>, valid types: <class 'int'>
Invalid type for parameter containerDefinitions[0].portMappings[0].hostPort, value: 7000, type: <class 'str'>, valid types: <class 'int'>

How can I input this json in the correct format?

0 Answers
Related