Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Batch Timeout connecting to ECR

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?

like image 386
alonana Avatar asked Jul 28 '26 10:07

alonana


2 Answers

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.

like image 141
Mark B Avatar answered Aug 01 '26 12:08

Mark B


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:

  • https://www.youtube.com/watch?v=9x_GQanUWJM
  • https://www.youtube.com/watch?v=o7s-eigrMAI&ab_channel=BeABetterDev

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.

like image 27
Alvin Smith Avatar answered Aug 01 '26 13:08

Alvin Smith



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!