Search code examples
amazon-web-servicesaws-sdkaws-batch

Get latest job revision while submitting AWS batch job without specifying the exact revision number


I am using AWSBatch Java client com.amazonaws.services.batch (AWS SDK for Java - 1.11.483) to submit jobs programmatically.

However, our scientists keep updating the job definition. Every time there is a new job definition, I have to update the environment variable with the revision number to pass it to the client. AWS documentation states that

This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.

Is there any way I can default it to the latest revision and every time I submit a BatchJob, the latest revision will get picked without even knowing the last revision?


Solution

  • This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.

    Seems like AWS didn't document this properly: revision is optional, you can use simply use name instead of name:revision and it will get the ACTIVE revision of your job definition. It's also optional for Job Definition ARNs.

    This also applies for boto3 and for AWS Step Functions integration with AWS Batch, and probably all other interfaces where Job Definition name or ARN are required.