Data ownership with Contentful

Published on May 18, 2020

Data ownership with Contentful

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

Contentful provides 99.96 to 99.99 availability depending on your enterprise SLA. This is sufficient in most cases, but sometimes you need even more reliability. Enterprises that store critical data in Contentful may need to satisfy legal or compliance requirements associated with data ownership and business continuity. Regulated and public enterprises might need to have backup protection in the unlikely event that Contentful ceases to operate in the future.

Contentful and AWS S3 offer a reliable, secure and out-of-the-box integration that solves these demands. It backs up data on your own infrastructure and allows you to maintain an audit log. You could also build a custom HA/DR/BPC procedure with Contentful.

Setting up AWS

Integrating AWS and Contentful begins by setting up an S3 bucket on AWS.  Below are screenshots that show how an S3 bucket is created via the AWS console:

Integrating AWS and Contentful

You will need to enable versioning, as seen below. This stores multiple versions of the same file as one:

Integrating AWS and Contentful

Use an existing user with the right permissions, or generate a new Access ID and Access Key that can be used from Contentful to write in this folder. The latter is the better option.

That’s all that is required from AWS. The remaining configuration can be done from the  Contentful web app. You need to be an admin or an owner of the space that you’re using to do so.

Using Contentful

Create a new webhook within Contentful using the AWS S3 template. 

AWS S3 webhook config screen

Enter the region and the name of the bucket, along with the access credentials. 

When an entry is created or updated, a JSON file is stored in this S3 bucket with all the info of the entry. The JSON file is versioned — you always see the latest version. If you want to publish content and aren’t concerned with draft content, then update the events when the webhook is triggered under the webhook settings. 

This covers most of the use cases:

  1. Backup of Contentful data in your AWS S3.

    1. You own your data, it is in your cloud.

    2. You’re ensured compliance and data availability in the unlikely event that Contentful does not exist in the future. 

  2. Create an audit log, because the data contains user information for each entry. Notice each JSON is associated with the user ID who made the change.

We still need to do one more thing to satisfy HA, DR and BCP requirements. If you are accessing Contentful directly from a client:

  1. Create a lambda or similar function that can be called from the client.

  2. In the lambda, make the Contentful call.

  3. If this fails, make the call to the S3 bucket to get the corresponding JSON.

  4. Massage the JSON from the S3 and remove unwanted elements. 

  5. Return it to the client. 

If you have a service that merges Contentful content and some form of React/Mustache templates, update this service to call the S3 bucket (similar to above) if Contentful is down.

Now,  even if Contentful is down, your digital experience will still function with the latest published data from the S3 bucket. 

Reliable integrations solve complex requirements

This simple, out-of-the-box integration between Contentful and AWS S3 is reliable and solves complex enterprise requirements. It demonstrates just how flexible and reliable SaaS- and API-based integrations are.

You can read more solutions to complex situations written by the Contentful team in our eBook Customizing Contentful: A developer’s guide.

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

Related articles

Charlie Bell, Senior Director of Solution Engineering EMEA at Contentful, and Sean Skamnes, VP of Partnerships at Commerce Layer, talk all things composable.
Insights

MACH-ing the jump to composable: Experts from Contentful and Commerce Layer weigh in

June 12, 2023

Illustrated graphic of a hand holding a fingerprint, representing a personalization strategy for lead generation
Insights

Content personalization for lead-gen is a piece of cake — here’s the recipe

November 5, 2021

Illustration of a man standing on a circular platform, holding a clipboard, looking at other platforms
Insights

Factors for evaluating digital platforms

March 22, 2021

Contentful Logo 2.5 Dark

Ready to start building?

Put everything you learned into action. Create and publish your content with Contentful — no credit card required.

Get started