Question

I've tried looking through the JetS3t API documentation but cannot seem to find the functionality to be able to invalidate existing files that we have on an Amazon CDN after they have been uploaded.

Does anyone know if this functionality does exist or if there is a suitable workaround?

Was it helpful?

Solution

I would suggest looking at Amazon CloudFront API. JetS3t was developed when the Amazon API was far more immature and less evolved than it is now. You'll find this feature is now supported. I refer you to: http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/CreateInvalidation.html

You need to create a new InvalidationBatch.

This article explains how to achieve this: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/cloudfront/model/CreateInvalidationRequest.html#CreateInvalidationRequest(java.lang.String,com.amazonaws.services.cloudfront.model.InvalidationBatch)

public CreateInvalidationRequest(String distributionId, InvalidationBatch invalidationBatch)

Constructs a new CreateInvalidationRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:

distributionId - The distribution's id.

invalidationBatch - The batch information for the invalidation.

OTHER TIPS

This is possible. I wrote some code to do this once. I used the JetS3t API to list the objects and then invalidated them like: http://jets3t.s3.amazonaws.com/toolkit/code-samples.html#cloudfront-invalidation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top