cloud-bucket-migrator

A lightweight library to migrate cloud buckets.

Usage no npm install needed!

<script type="module">
  import cloudBucketMigrator from 'https://cdn.skypack.dev/cloud-bucket-migrator';
</script>

README

cloud-bucket-migrator

A lightweight library to migrate cloud buckets. It includes : upload a local directory to a remote cloud bucket, download a bucket to a local directory or transfer an origin bucket to a target bucket.

Features

  • Download a bucket
  • Upload a local directory to a bucket
  • Migrate a bucket ( Cross-Account supported )

Support

Currently only AWS S3 buckets operations are supported.

Installation

$ npm install cloud-bucket-migrator

Loading the module

const cloudBucketMigrator = require('cloud-bucket-migrator');

Common Usage

Download bucket

const path = 'LOCAL_PATH'; 
const platform = 'AWS_S3';
const bucketName = 'ORIGIN_BUCKET_NAME';
const credentials = {
    accessKey: 'ACCESS_KEY',
    secretKey:  'SECRET_KEY'
}

(async function() {
    await cloudBucketMigrator.downloadBucket(platform, credentials, bucketName, path);
})();

Upload bucket

const path = 'LOCAL_PATH'; 
const platform = 'AWS_S3';
const bucketName = 'TARGET_BUCKET_NAME';
const credentials = {
    accessKey: 'ACCESS_KEY',
    secretKey:  'SECRET_KEY'
}

(async function() {
    await cloudBucketMigrator.uploadBucket(platform, credentials, bucketName, path);
})()

Migrate bucket

const originPlatform = 'AWS_S3';
const originBucketName = 'ORIGIN_BUCKET_NAME';
const originCredentials = {
    accessKey: 'ORIGIN_ACCESS_KEY',
    secretKey:  'ORIGIN_SECRET_KEY'
}

const targetPlatform = 'AWS_S3';
const targetBucketName = 'TARGET_BUCKET_NAME';
const targetCredentials = {
    accessKey: 'TARGET_ACCESS_KEY',
    secretKey:  'TARGET_SECRET_KEY'
}

(async function() {
    await cloudBucketMigrator.migrateBucket(originPlatform, credentials, originBucketName, targetPlatform, credentials, targetBucketName);       
})();

License

MIT