Reputation: 5995
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.
Edit 1: The revision exists in the task-definition of AWS. I can see that specific revision from AWS console. As I've already mentioned the command runs successfully from cli using that specific revision.
Edit 2: I'm able to list-task-definitions using aws ecs list-task-definitions
and I see that particular task definition in the list but I'm not able to describe that task definition using ${TASK_FAMILY}:${TASK_REVISION}. It gives me the same error.
Upvotes: 8
Views: 19464
Reputation: 101
It seems that AWS CLI commands from within a bash-script file don't work if the task-definition or the service are full ARNs (contrary to the documentation). My script started working as soon as I stripped the task-definition and the service to their name(and revision number) by removing the arn:aws:..../ part.
Just to be clear, the full arn for task-definitions and service do work from the command prompt...just not from withinthe bash-script.
Upvotes: 0
Reputation: 5995
Well I figured out that aws ecs describe-task-definition ${TASK_FAMILY}
was working while aws ecs describe-task-definition ${TASK_FAMILY}:${TASK_REVISION}
was throwing the same Invalid revision number error
.
So I tried the update-service command without using ${TASK_REVISION} variable like this:
aws ecs update-service --cluster ${CLUSTER_NAME} --service ${SERVICE_NAME} --task-definition ${TASK_FAMILY} --desired-count ${DESIRED_COUNT}
and it worked. It also uses the latest revision of the task definition.
Upvotes: 5