Skip to content

FlashParking-Inc/serverless-s3-replication-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless S3 replication plugin

serverless Coverage Status

This is a serverless plugin to easily setup replications between AWS S3 buckets. The plugin allows you to set up single direction and/or bidirectional replication.

The plugin will wait until all buckets from the configuration exist. If they all succeed, the plugin will modify the configured S3 buckets and add replication to them. Also, the required IAM roles will automatically be created for you. The IAM role follows the best practice to only have the permissions to resources it really needs. There will be a unique IAM role in each region.

Install

npm install --save-dev serverless-s3-replication-plugin

Usage

  1. Configure the plugin in your serverless.yml
plugins:
- serverless-s3-replication-plugin
  1. Add the configuration for the plugin

2.1. Single direction replication example

custom:
  s3ReplicationPlugin:
    singleDirectionReplication:
      - sourceBucket:
          eu-west-1: my-bucket-jlsadjklsd-eu-west-1
        targetBuckets:
          - eu-west-2: my-bucket-jlsadjklsd-eu-west-2
          - eu-west-1: my-bucket-jlsadjklsd-sec-eu-west-1
      - sourceBucket:
          eu-central-1: my-bucket-jlsadjklsd-eu-central-1
        targetBuckets:
          - eu-west-1: my-bucket-jlsadjklsd-eu-west-1

2.2. Bidirectional replication example

custom:
  s3ReplicationPlugin:
    bidirectionalReplicationBuckets:
      - eu-west-1: my-bucket-jlsadjklsd-eu-west-1
      - eu-central-1: my-bucket-jlsadjklsd-eu-central-1
      - us-east-1: my-bucket-jlsadjklsd-us-east-1

2.3. Hybrid architecture with bidirectional and single direction replication

custom:
  s3ReplicationPlugin:
    singleDirectionReplication:
      - sourceBucket: 
          eu-west-1: my-bucket-jlsadjklsd-eu-west-1
        targetBuckets: 
          - eu-west-2: my-bucket-jlsadjklsd-eu-west-2
          - eu-west-1: my-bucket-jlsadjklsd-sec-eu-west-1
      - sourceBucket: 
          eu-central-1: my-bucket-jlsadjklsd-eu-central-1
        targetBuckets: 
          - eu-west-1: my-bucket-jlsadjklsd-eu-west-1
    bidirectionalReplicationBuckets:
      - eu-west-1: my-bucket-jlsadjklsd-eu-west-1
      - eu-central-1: my-bucket-jlsadjklsd-eu-central-1
      - us-east-1: my-bucket-jlsadjklsd-us-east-1

About

A plugin to setup replication across AWS S3 buckets

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%