Creating a Cloudfront Invalidation BaaS

Creating a Cloudfront Invalidation BaaS

In this tutorial we will use a BaaS that was originally used to work with amazon translate, we will then modify it and use it as a BaaS that lets us invalidate a cache in cloudfront.

{
  "Method": "createInvalidation",
  "Endpoint": "Cloudfront",
  "Alias": "awscloudfrontinvalidate",
  "Organization": "sbdemo2"
  "RequestMapping": {
    "DistributionID": {
      "type": "requestBody",
      "requestBodyPath": "$.DistributionID",
      "inputPath": "$.DistributionID"
    },
    "CallerReference": {
      "type": "requestBody",
      "requestBodyPath": "$.InvalidationBatch.CallerReference",
      "inputPath": "$.InvalidationBatch.CallerReference"
    },
    "Quantity":{
      "type": "requestBody",
      "requestBodyPath": "$.InvalidationBatch.Paths.Quantity",
      "inputPath": "$.InvalidationBatch.Paths.Quantity"
    },
    "Items":{
      "type": "requestBody",
      "requestBodyPath": "$.InvalidationBatch.Paths.Items",
      "inputPath": "$.InvalidationBatch.Paths.Items"
    }
  },
  "ResponseMapping": {
  	"result": {
      "type": "responseBody",
      "responseBodyPath": "$.result",
      "outputPath": "$.result"
    }
  },
  "Type": "aws-sdk",
  "Body": {},
  "Region": "eu-west-1",
  "Credentials": "srn:vault::sbdemo2:secretdoc:content-cloudfront-key"
}

Make sure to update the alias and org in credentials if copy and pasting!

Last updated on