Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with ECS container: ResourceInitializationError : failed to create Cloudwatch log stream

I am trying to set up an ECS Fargate container but it throws me this error:

"ResourceInitializationError: failed to validate logger args: create stream has been retried 1 times: failed to create Cloudwatch log stream: ResourceNotFoundException: The specified log group does not exist. : exit status 1"

I've already checked and the log group exists and it has the same name in the task definition. I've checked the ecsTaskExecutionRole policy (it has cloudWactchLogsFullAccess policy), also thought that could be the internet access but I checked the vpc, subnet, and route table and everything seems ok (I don't know how to check if the container really has internet access).

like image 335
Tomás Garcia Avatar asked Jul 30 '26 01:07

Tomás Garcia


1 Answers

One of my Fargate services had mysteriously stopped and I was seeing this error as well.

In my case, I had deleted the log group which the service was using and this caused the launching of the task to fail on subsequent retries.

You say that your log group still exists though, so I'm not sure if it's the same problem.

Anyway, my FIX using the AWS Console:

  1. Navigate to the task that failed to launch Select task
  2. View in CloudWatch View logs
  3. Get the name of the CloudWatch log group that the task is expecting to save to Copy log group name
  4. Create a new CloudWatch log group matching with this name Create log group Match name

Now the service has a log group to save to and your tasks should successfully start again.

like image 141
Wesley Cheek Avatar answered Aug 01 '26 20:08

Wesley Cheek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!