How do you clean up old Batch job definitions?

0

I'm using AWS Batch jobs with ECS to perform my scheduled tasks (db backup, etc.) Everything is working fine but after just short while I have a lot of old, unused job definitions in my AWS Batch console.

The situation is this; when I update the application code it creates a new container and puts it in ECR. When the new container gets put into ECR I updated the AWS Batch job definitions that rely on that container. Well, when I update the code 3-4 times a day it doesn't take long to have a pretty large backlog of old, unused job definitions sitting around in my AWS Batch console.

How do you deal with these? Is there some way to expire definitions and only keep the most current one? Is there another way to update the ECR container in the job definition that doesn't require creating a whole new job definition? Or does everyone just live with 100's of old, unused job definitions?

1개 답변
1

Hello.

I don't think there is a way to delete it directly as of April 2024.
Therefore, I think it is better to deregister the old batch job definition and wait for it to be automatically deleted after 180 days.
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/batch/deregister-job-definition.html

Deregisters an Batch job definition. Job definitions are permanently deleted after 180 days.

profile picture
전문가
답변함 한 달 전
  • That's good information. How do others handle this situation? Does everyone just let the old job definitions just pile up? Is there some automated way to deregister them?

  • In my case, I tried to deregister things that I no longer needed. Since there is no automatic deregistration function, I think the only option is to create a Lambda etc. and periodically deregister.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인