/archive

Amazon S3 Replication with KMS, CDK, and CloudFormation StackSets.

Primary LanguageTypeScriptMIT LicenseMIT

S3 Archive with Regional Replications

MIT License sbstjn.com

Use the AWS Cloud Development Kit to deploy an Amazon S3 Bucket in your desired region and enable regional bucket replications for backups.

Architecture

  • CloudFormation Stack with S3 Bucket, KMS, and StackSet
  • CloudFormation StackSet for S3 regional replication

Usage

Prerequisites

To use self-managed StackSets, you need to create two IAM roles first. You can create them manually using the AWS Management Console or use the official CloudFormation templates provided by AWS:

Configuration

Modify aws/index.ts to configure your archive and replication:

const prefix = 'example'
const option = {
  prefix,
  env: {
    region: 'eu-central-1'
  },
  replications: [
    'eu-west-1',
    'eu-north-1'
  ]
}

Deployment

# Deploy CloudFormation Stack with CDK

$ > npx cdk deploy

[…]

Outputs:
Archive.BucketName = example-archive
Archive.BucketRegion = eu-central-1
Archive.BucketReplications = eu-west-1, eu-north-1