Batch Delete Image for ECR with Multiple Image Digests #3261
-
I want to delete multiple images using their digests with batch_delete_image method. I have a loop to get multiple digests. However, I am not sure about the syntax and couldn't find any examples. I tried passing it as an array of Digests and even with comma separated string, but nothing worked. Can anyone please help with some examples and syntax? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @vesubramanian here is the boto3 documentation for Does that help? If you're still having issues please share a code snippet of your approach. |
Beta Was this translation helpful? Give feedback.
-
Thank you @tim-finnigan. I have seen this link. However, if I want to delete multiple images by passing their Image Digests, how can I achieve that? I need the syntax to pass multiple Image Digests. |
Beta Was this translation helpful? Give feedback.
-
I got it working now. It was expecting a list of dictionaries for the imageIds argument. Below is my code. imgDigestList = [] delResp = client.batch_delete_image(registryId = accountId, repositoryName = repo['repoName'], imageIds = imgDigestList) Thanks a lot once again for your help. |
Beta Was this translation helpful? Give feedback.
I got it working now. It was expecting a list of dictionaries for the imageIds argument. Below is my code.
imgDigestList = []
for img in imgList:
imgDigestDict = {}
imgDigestDict['imageDigest'] = img['imageDigest']
imgDigestList.append(imgDigestDict)
delResp = client.batch_delete_image(registryId = accountId, repositoryName = repo['repoName'], imageIds = imgDigestList)
Thanks a lot once again for your help.