AWS Batch | Missing credentials in config

Error sending notification: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 Error: connect EINVAL 169.254.169.254:80 - Local (0.0.0.0:0)

1 Like

Here is the solution:

The job role was not added to the job definition.
Example : in yml file

GenerateAlertsBatchJobDefinition:
      Type: AWS::Batch::JobDefinition
      Properties:
        Type: container
        JobDefinitionName: generate-alerts-job-definition-${opt:stage, 'dev'}
        RetryStrategy:
          Attempts: 1
        ContainerProperties:
          Command: 
            - node 
            - generate_alerts.js
          Image:  ${ssm:DOCKER_IMAGE}
          ExecutionRoleArn: !GetAtt JobDefinationRole.Arn
          NetworkConfiguration:
              AssignPublicIp: ENABLED
          FargatePlatformConfiguration:
            PlatformVersion: LATEST
          ResourceRequirements:
            - Value: 0.25
              Type: VCPU
            - Value: 512
              Type: MEMORY
          Environment:
            - Name: MONGODB_CONNECTION_STRING
              Value: ${ssm:MONGODB_CONNECTION_STRING}
            - Name: STAGE
              Value: ${opt:stage, 'dev'}
            - Name: FIREBASE_CREDENTIALS_FILE
              Value: ${ssm:FIREBASE_CREDENTIALS_FILE}
            - Name: S3_BUCKET_NAME
              Value: ${ssm:BUCKET_NAME}
          JobRoleArn: ${ssm:BATCH_ROLE_ARN}
        PlatformCapabilities:
          - FARGATE
4 Likes