I am using AWS cloudfront for caching images on cloudfront for fast retrieval of images. If the image is not cached in cloudfront, cloudfront fetches the image from my custom server and caches it too for next request. Due to some unxplained issue, some images are cached on cloudfront with 0 size, even though the custom server is returning full images.
So, I want to write a script to list all objects cached in a distribution, check its metadata, and invalidate the image object from cloudfront cache if its size is zero. But I couldnt find any method in cloudfront API to list all objects, or even find any object's metadata(for size).
Thanks.