Purge the cache of spaces cdn with amazon sdk s3 for java version 2

  • Posted January 31, 2019
  • CDN

I’m tryind to purge cache during my build process after uploading files to spaces cdn. But can’t do it with amazon sdk java version 2.

I have this article

but can’t understand how to do it with amazon sdk. Should I user CloudFrontClient or something other?

What should I do, I wrote this code, but it fails? ( What shoud i use for distributionId?

def cfc = CloudFrontClient .builder() .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials .create( digitalOceanProps.getProperty(“Cdn_key”), digitalOceanProps.getProperty(“Cdn_secret”)))) .region(Region.of(“sfo2”)) .endpointOverride(URI.create(“”)) .build()

        def paths = Paths.builder()

        def invalidationBatch = InvalidationBatch.builder()

        def invalidationRequest = CreateInvalidationRequest.builder()

        CreateInvalidationResponse ret = cfc.createInvalidation(

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!