Using AWS Batch can a docker image be specified dynamically in a job definition?
Asked Answered
K

2

9

I want to create jobs in AWS Batch that vary on the image that is used to launch the container. I'd like to do this without creating a different Job Definition for each image. Is it possible to parameterize the image property using job definition parameters? If not, what's the best way to achieve this or do I have to just create job definitions on the fly in my application?

Kishke answered 20/6, 2018 at 2:7 Comment(0)
A
6

I would really love this functionality as well. Sadly, it appears the current answer is no. Batch allows parameters, but they're only for the command.

AWS Batch Parameters

You may be able to find a workaround be using a :latest tag, but then you're buying a ticket to :latest hell.

My current solution is to use my CI pipeline to update all dev job definitions using the aws cli (describe-job-definitions then register-job-definition) on each tagged commit.

To keep my infrastructure-as-code consistent, I've moved the version for batch job definitions into an environment variable that I retrieve before running any terraform commands.

Alena answered 7/10, 2019 at 17:38 Comment(1)
Do you have any specific commands on how you update your job definitions?Buckskins
A
-5

Typically you make a job definition for a docker image. However that job definition and docker can certainly do anything you've programmed it to do so it can be multi-purpose and you pass in whatever parameter or command line you would like to execute.

You can override most of the parameters in a Job definition when you submit the job.

Analogue answered 21/6, 2018 at 6:28 Comment(1)
Please provide a snippet if you've been able to override the job definition's Image property dynamicallyKylstra

© 2022 - 2024 — McMap. All rights reserved.