Option to not deregister prior AWS Batch Job Definition revisions
Name of the resource
AWS::Batch::JobDefinition
Resource name
No response
Description
Add an option to the CloudFormation definition of AWS Batch Job Definitions that will prevent updates which result in a new revision from deregistering the previous revision. At a minimum a simple boolean, conceptually something like LeaveOldRevisionsActive, would work. That puts the onus on clients to handle cleaning up older revisions though. Ideally it would include a count of the number of prior revisions to leave active, which would allow revisions to naturally be deregistered and eventually cleaned up without client involvement.
Other Details
We adhere to a strict rule of immutable deploys, which means a given version of a deployed service always launches Batch jobs using a specific Job Definition revision. When we deploy a new version of a service there is a window of time between when the CloudFormation stack is updated and the new service code is active (and the old service code inactive) where launching jobs will fail because the CloudFormation update has deregistered the job definition revision that the old service code is reliant upon.
Very surprising this issue hasn’t been addressed by AWS. What is the purpose of revisions if only the last one is usable?
We're facing the exact same issue.
we have the same issue too
AWS Batch has released the ability to skip deregistering the previous revision on update events for AWS::Batch::JobDefinition resources.
This feature can be utilized via these properties: ResourceRetentionPolicy and its child attribute SkipDeregisterOnUpdate.
Here are the CFN docs on these properties:
- https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-resourceretentionpolicy
- https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-batch-jobdefinition-resourceretentionpolicy.html