Resource Initialization error in ECS fargate service

0

I have created task defintion with cft and passed the environment variable through the arn of s3 bucket. Its working for one service but for another its giving resource initialization errror.

The env file is available in the s3 bucket still I am getting this error and permission to get object from s3 bucket is also given.

These are the permissions which are given to the execution role:

s3:ListBucket,s3:PutObject,s3:GetObject,s3:GetBucketLocation,sqs:sendmessage,ecr:GetAuthorizationToken,ecr:BatchCheckLayerAvailability,ecr:GetDownloadUrlForLayer,ecr:BatchGetImage,logs:CreateLogStream,logs:PutLogEvents,ecs:RunTask,iam:PassRole

Enter image description here

1 Answer
0

Ref: https://repost.aws/knowledge-center/ecs-task-environment-variables

"ResourceInitializationError: failed to download env files: file download command: non empty error stream"

You might face issues when you pass environment variables to your Amazon ECS tasks due to the following reasons:

Your Amazon ECS task execution role doesn't have the required AWS Identity and Management (IAM) permissions. There are issues with your network configuration. Your application is unable to read the environment variable. The format of variable in the container definition is incorrect. The environment variable isn't automatically refreshed. To troubleshoot the errors for Amazon ECS tasks that fail to start, use the AWSSupport-TroubleshootECSTaskFailedToStart runbook. Then, refer to the relevant troubleshooting steps for your issue.

It could also be linking wrong security group to the service or attaching internet gateway to route table . Check if public ip is enabled on ECS

profile picture
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions