CodexBloom - Programming Q&A Platform

scenarios when using AWS Batch with Spot Instances: scenarios to submit job with invalid job definition revision

👀 Views: 381 💬 Answers: 1 📅 Created: 2025-06-05
aws aws-batch spot-instances boto3 Python

I'm stuck on something that should probably be simple. I'm trying to set up an AWS Batch job that utilizes Spot Instances, but I'm running into an scenario where the job fails to submit with the behavior message: "InvalidParameterValue: Failed to submit job with invalid job definition revision". I've created my job definition and referenced it correctly in my job submission, but something seems to be off. Here's the code snippet I'm using to submit the job: ```python import boto3 batch_client = boto3.client('batch') response = batch_client.submit_job( jobName='my-spot-job', jobQueue='my-job-queue', jobDefinition='my-job-definition:1', # Attempting with revision 1 containerOverrides={ 'vcpus': 1, 'memory': 1024, 'command': ['echo', 'Hello from my Spot Instance!'], }, timeout={ 'attemptDurationSeconds': 3600 }, retryStrategy={ 'attempts': 1 } ) print(response) ``` I've confirmed that my job definition exists and is active, and the job queue is configured to use Spot Instances. However, I still receive the behavior. I’ve also tried adjusting the job definition revision number, but it made no difference. My AWS SDK version is 1.18.69, and I’m using Python 3.8. Could there be a configuration scenario with my job definition or queue? Are there specific settings for Spot Instances in AWS Batch that I might be missing? Any help would be greatly appreciated! Thanks in advance!