Data ownership with Contentful
![A data bank encased in a bell jar, referring to owning your data with Contentful](https://images.ctfassets.net/fo9twyrwpveg/6cA1JOyUKwXLC0OK4Qmdju/d0eaa77854870f675cef52ee6b1a7a7a/Jsuif7Dg.png?fm=jpg&q=90&w=1536)
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 begins by setting up an S3 bucket on AWS](https://images.ctfassets.net/fo9twyrwpveg/2eyhb03d9MNdu5PRUaqqam/e4d3308fbd4f215b206a5b53f07f75df/Screen_Shot_2019-05-30_at_11.15.52_AM.png)
You will need to enable versioning, as seen below. This stores multiple versions of the same file as one:
![You will need to enable versioning, as seen below.](https://images.ctfassets.net/fo9twyrwpveg/nzvyEGURZQqS9FVdXsOt7/aac7c3c476b7283b0d7d625d09da584c/Screen_Shot_2019-05-30_at_11.28.04_AM.png)
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.Â
![Create a new webhook within Contentful using the AWS S3 template.](https://images.ctfassets.net/fo9twyrwpveg/5WKbTmVc8luVLiyQIrYwYN/8b099b027ae6e74e5abec898868047b8/AWS_S3_webhook_config_screen.png)
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:
Backup of Contentful data in your AWS S3.
You own your data, it is in your cloud.
You’re ensured compliance and data availability in the unlikely event that Contentful does not exist in the future.Â
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:
Create a lambda or similar function that can be called from the client.
In the lambda, make the Contentful call.
If this fails, make the call to the S3 bucket to get the corresponding JSON.
Massage the JSON from the S3 and remove unwanted elements.Â
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.