AWS ECS InvalidParameterExcpetion when calling the UpdateService Operation

I’ve been trying to setup CI/CD for my ECS cluster using jenkins. I followed this blog to do the same. But I’m getting this error:

An error occurred (InvalidParameterException) when calling the
UpdateService operation: Invalid revision number. Number: 49

The command used to update the service is:

aws ecs update-service --cluster ${CLUSTER_NAME} --service ${SERVICE_NAME} --task-definition ${TASK_FAMILY}:${TASK_REVISION} --desired-count ${DESIRED_COUNT}

Surprisingly, if I run the command from cli putting all the values, it runs successfully. I’m not sure what is wrong with the command.

Source: StackOverflow