Skip to content

@batch step fails locally with 'No IAM role specified' when no per-job IAM role is configured #3208

@aspratyush

Description

@aspratyush

On EC2 compute environments that use an instance profile for container credentials, running any @batch step fails immediately — before the job reaches AWS — with:

BatchJobException: Unable to launch AWS Batch job. No IAM role specified.

METAFLOW_ECS_S3_ACCESS_IAM_ROLE is not set; the container is expected to acquire credentials from the EC2 instance profile.

Metaflow version: master, 4871fb1
Deployment: AWS Batch on EC2 compute environment, no per-job IAM role

Steps to reproduce

  1. EC2 compute environment using instance-profile credentials
  2. METAFLOW_ECS_S3_ACCESS_IAM_ROLE not set
  3. Run any @batch-decorated flow

Expected
Job submits successfully; the AWS Batch ContainerProperties API documents jobRoleArn as optional.

Actual
The guard in batch_client.py (L82–85) raises unconditionally when iam_role is None, and _register_job_definition always passes "jobRoleArn": job_role to boto3 even when job_role is None, which boto3 rejects for string fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions