fabfuel / ecs-deploy

Powerful CLI tool to simplify Amazon ECS deployments, rollbacks & scaling
Other
843 stars 144 forks source link

Error when deploying to Fargate container that has awsfirelens log driver specified #164

Open kellemar opened 3 years ago

kellemar commented 3 years ago

Hi all,

I'm getting this issue when trying to deploy a new task with an updated task definition. I have awsfirelens configured which sends my logs to an external source such as Datadog.

botocore.errorfactory.ClientException: An error occurred (ClientException) when calling the RegisterTaskDefinition operation: When awsfirelens log driver is specified in log configuration, a firelens configuration object must be configured in one of the containers.

Is there anything I can do to resolve this?

fabfuel commented 3 years ago

Hi @kellemar,

just to double check: The container does have the firelens configuration before you do the re-deployment? Could you share your task definition or the relevant parts, please?

What versions of boto3 and botocore do you use?

Please try to update boto3 and botocore manually in the environment you run ecs-deploy in:

pip install boto3 botocore --upgrade

Does this solve the issue?

Thanks Fabian

kellemar commented 3 years ago

Hi Fabian,

Thanks for the help. Yup, the container has the firelens deployment. Here are my container definitions with Terraform.

I can update manually with either Terraform or in the AWS ECS console. But with Jenkins, and running ecs deploy, it fails with the above error.

Also, I've just updated boto3 and botocore, and awscli too. Boto to 1.17 and 1.20

container_definitions = jsonencode( [ { cpu = 0 environment = [] essential = true image = "XXX.dkr.ecr.ap-southeast-1.amazonaws.com/nginx-sidecar-ec2:latest" logConfiguration = { logDriver = "awsfirelens" options = { Host = "http-intake.logs.datadoghq.com" Name = "datadog" TLS = "on" apikey = "XXXX" dd_message_key = "log" dd_service = "tap-sg" dd_source = "nginx" dd_tags = "project:fluent-bit" provider = "ecs" } } memoryReservation = 128 mountPoints = [] name = "nginx" portMappings = [ { containerPort = 80 hostPort = 80 protocol = "tcp" }, ] volumesFrom = [] }, { cpu = 0 environment = [] essential = true image = "XXXX.dkr.ecr.ap-southeast-1.amazonaws.com/prod-tap-sg:589c05" logConfiguration = { logDriver = "awsfirelens" options = { Host = "http-intake.logs.datadoghq.com" Name = "datadog" TLS = "on" apikey = "XXXXX" dd_message_key = "log" dd_service = "tap-sg" dd_source = "nodejs" dd_tags = "project:fluent-bit" provider = "ecs" } } memoryReservation = 128 mountPoints = [] name = "reactjs" portMappings = [ { containerPort = 3000 hostPort = 3000 protocol = "tcp" }, ] volumesFrom = [] }, { cpu = 0 environment = [] essential = true firelensConfiguration = { type = "fluentbit" } image = "XXXX.dkr.ecr.ap-southeast-1.amazonaws.com/aws-for-fluent-bit:latest" mountPoints = [] name = "log_router" portMappings = [] user = "0" volumesFrom = [] }, ] ) cpu = "512" execution_role_arn = "arn:aws:iam::XXXX:role/ecsTaskExecutionRole" family = "tap-fargate-nginx-reactjs-sg" memory = "1024" network_mode = "awsvpc" requires_compatibilities = [ "FARGATE", ] tags = {} task_role_arn = "arn:aws:iam::XXXX:role/ecsTaskExecutionRole"

kellemar commented 3 years ago

It also looks similar to this issue I found: https://github.com/spinnaker/spinnaker/issues/5203

abertoldo commented 1 year ago

Hello, did you manage to solve it? I have the same problem...

fabfuel commented 1 year ago

Hi everyone, I can not reproduce this anymore in the current development version. The AWS FireLens configuration stays in tact, when deploying. Which version are you using @abertoldo?

Best Fabian