AWS Fargate ResourceInitializationError: unable to pull secrets or registry

0

Slightly tearing my hair out with this one... I am trying to run a Docker image on Fargate in a VPC in a Public subnet. When I run this as a Task I get:

ResourceInitializationError: unable to pull secrets or registry auth: pull
command failed: : signal: killed
If I run the Task in a Private subnet, through a NAT, it works. It also works if I run it in a Public subnet of the default VPC.

I have checked through the advice here:

Aws ecs fargate ResourceInitializationError: unable to pull secrets or registry auth

In particular, I have security groups set up to allow all traffic. Also Network ACL set up to allow all traffic. I have even been quite liberal with the IAM permissions, in order to try and eliminate that as a possibility:

The task execution role has:

{
"Action": [
"kms:",
"secretsmanager:
",
"ssm:",
"s3:
",
"ecr:",
"ecs:
",
"ec2:"
],
"Resource": "
",
"Effect": "Allow"
}
With trust relationship to allow ecs-tasks to assume this role:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ecs-tasks.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
The security group is:

sg-093e79ca793d923ab All traffic All traffic All 0.0.0.0/0
And the Network ACL is:

Inbound
Rule number Type Protocol Port range Source Allow/Deny
100 All traffic All All 0.0.0.0/0 Allow

  • All traffic All All 0.0.0.0/0 Deny

Outbound
Rule number Type Protocol Port range Destination Allow/Deny
100 All traffic All All 0.0.0.0/0 Allow

  • All traffic All All 0.0.0.0/0 Deny
    I set up flow logs on the subnet, and I can see that traffic is Accept Ok in both directions.

I do not have any Interface Endpoints set up to reach AWS services without going through the Internet Gateway.

I also have Public IP address assigned to the Fargate instance upon creation.

This should work, since the Public subnet should have access to all needed services through the Internet Gateway. It also works in the default VPC or a Private subnet.

Can anyone suggest what else I should check to debug this?

asked 3 years ago6886 views
2 Answers
1

Thanks. It was DNS, with DNS enabled it works fine.

Edited by: rupertlssmith on Apr 30, 2021 4:51 AM

answered 3 years ago
profile picture
SUPPORT ENGINEER
reviewed 2 years ago
0

Hi,
It looks interesting problem. As you are saying it works fine in default VPC then we can rule out the role permission issue. If it does not work in new VPC it means there is some issue with the new VPC. Can you check if enableDnsSupport property is enabled for this VPC.

Thanks

shivpal
answered 3 years 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

Relevant content