6

I get the following error running an AWS batch job:

ResourceInitializationError: unable to pull secrets or registry auth: execution resource retrieval failed: unable to retrieve ecr registry auth: service call has been retried 3 time(s): RequestError: send request failed caused by: Post https://api.ecr.us-east-1.amazonaws.com/: dial tcp 54.239.19.155:443: i/o timeout

I am using Fargate option for the AWS batch compute environment.

My VPC contains a subnet with 'auto assign public IPv4 address', an internet gateway, and a matching route table. I thought that this might be a problem in my VPC, so to verify that, I've launched a new EC2 instance in the VPC, and run in the EC2 instance curl to https://api.ecr.us-east-1.amazonaws.com. The curl can connect without any issues.

What could be the problem?

alonana
  • 171
  • 2
  • 12
  • 1
    The VPC setting "auto assign public IPv4 address" only applies to EC2 instances I believe. For Fargate tasks in ECS or Batch you need to enable the `assignPublicIp` setting. https://docs.aws.amazon.com/batch/latest/userguide/fargate.html – Mark B Jun 16 '22 at 13:27
  • I've changed the job definition as you have specified. This solved the issue. Thanks! – alonana Jun 16 '22 at 18:08
  • Since it solved the issue for you, I reposted my command as an answer. – Mark B Jun 16 '22 at 18:35

2 Answers2

5

The VPC setting "auto assign public IPv4 address" only applies to EC2 instances I believe. For Fargate tasks in ECS or Batch you need to enable the assignPublicIp setting.

Mark B
  • 183,023
  • 24
  • 297
  • 295
2

The best answer is right. "The VPC setting "auto assign public IPv4 address" only applies to EC2 instances I believe. For Fargate tasks in ECS or Batch, you need to enable the assignPublicIp setting."

Albeit please make sure the VPC is correct first before diving into roles, tasks and policy.

To configure VPC for Fargate correctly:

The first video is the one I followed since I didn't want a load balancer. Although, I turned on the auto-generated subtitles as it's in Spanish.

Alvin Smith
  • 547
  • 5
  • 9