I'm using lambda for "Long running jobs" in a way, described in the link below:
Long running jobs in AWS Lambda
Which is working correctly till the lambda triggers the task, but the task fails with the error message:
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
I've searched and found several solutions applied them but didn't get the correct answer to sort out my issue, I'm using the public subnet with proper route set with gateway. But still its not working.
I've created the stack using the yaml below:
Resources:
GetVideoAlphaExecutionRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: GetVideoAlphaExecutionRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: "ecs-tasks.amazonaws.com"
Action: "sts:AssumeRole"
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
GetVideoAlphaTaskRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: GetVideoAlphaTaskRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: "ecs-tasks.amazonaws.com"
Action: "sts:AssumeRole"
Policies:
- PolicyName: IAMPolicyGetVideoAlpha
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "s3:PutObject"
Resource:
- arn:aws:s3:::get-video-alpha-bucket/*
GetVideoAlphaTaskDefinition:
Type: "AWS::ECS::TaskDefinition"
DependsOn: GetVideoAlphaExecutionRole
Properties:
ContainerDefinitions:
- Image: 123445678.dkr.ecr.us-east-1.amazonaws.com/get-video-alpha:latest
Name: get-video-alpha
Cpu: 256
Memory: 512
RequiresCompatibilities:
- FARGATE
NetworkMode: awsvpc
ExecutionRoleArn: { "Ref": GetVideoAlphaExecutionRole }
TaskRoleArn: { "Ref": GetVideoAlphaTaskRole }
GetVideoAlphaCluster:
Type: "AWS::ECS::Cluster"
Properties:
ClusterName: get-video-alpha
GetVideoAlphaService:
Type: "AWS::ECS::Service"
DependsOn: GetVideoAlphaTaskDefinition
Properties:
Cluster: { "Ref": "GetVideoAlphaCluster" }
LaunchType: FARGATE
ServiceName: get-video-alpha
DesiredCount: 0
NetworkConfiguration:
AwsvpcConfiguration:
Subnets:
- subnet-08e9a9531a9a86a8f
SecurityGroups:
- sg-08b4ce654be608cf5
AssignPublicIp: ENABLED
TaskDefinition: { "Ref": "GetVideoAlphaTaskDefinition" }
Any help to sort this out? Or need any further information, please do let me know.
Thanks.