Skip to content

A CDK stack that creates a Lambda function for automating backups of a Contentful environment and storing them in an S3 bucket.

License

Notifications You must be signed in to change notification settings

kernpunkt/contentful-backup

Repository files navigation

Contentful Backup

A CDK stack for automatically generating Contentful backups.

This repository is a CDK stack which deploys a Lambda function and a S3 bucket to your AWS account and will run automatic backups from your Contentful instance.

Contributors

Image Name Team E-Mail
Jörn Meyer Funkeys++ [email protected]

Built with

AWS TypeScript Contentful


Deploy

  1. Create your own environment file by executing cp .env.example .env.
  2. Modify the values in the .env file to your liking. Please pay special attention to the SCHEDULE variable1.
  3. Afterwards, run cdk synth2.
  4. Your backups will automatically show up in the S3 bucket called [YOUR_PREFIX]-contentful-backup-bucket.

Configuration variables

Variable Use
CONTENTFUL_MANAGEMENT_TOKEN Your personal access token for the Contentful Management API. Find yours here.
CONTENTFUL_SPACE_ID The space ID for your Contentful space. Find yours here.
CONTENTFUL_ENVIRONMENT_ID The identifier for your Contentful environment. Default is master.
PREFIX This string gets prefixed to all resource names in your AWS so you can run multiple backups for multiple Contentful spaces in the same AWS account without namespace pollution.
SCHEDULE The schedule your backups should be created on. Uses cron syntax, so, for example cron(0 23 * * ? *) will make a backup every night at 11pm.
TIMEOUT_MINUTES The timeout in minutes for the Lambda function creating your backups.
MEMORY_SIZE The memory limit for the Lambda function in MB.

Useful commands

Command Result
npm run build compile typescript to js
npm run watch watch for changes and compile
npm run test perform the jest unit tests
cdk deploy deploy this stack to your default AWS account/region
cdk diff compare deployed stack with current state
cdk synth emits the synthesized CloudFormation template

Footnotes

  1. AWS uses the UTC timezone, so adjust accordingly.

  2. Remember to export AWS_PROFILE=your-aws-profile beforehand.

About

A CDK stack that creates a Lambda function for automating backups of a Contentful environment and storing them in an S3 bucket.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published