Skip to main content

CBS Data Migration to Encrypted Disk

Project description

Tccbsmig

Tccbsmig is designed to batch transfer all the data on an unencrypted CBS mounted on a CVM to an encrypted CBS for Tencent Cloud. To use it, you need to prepare a JSON file as an input, which includes your account SecrectID, SecrectKey, and all related CVM Instances and storages information.

For each disk needs to be encrypted, tccbsmig automatically calls CBS APIs to create a new encrypted CBS disk and mount it on the instance where unencrypted disk is attached, and then copies the data from unencrypted disk to the encrypted, and detaches the unencrypted disk after data transfer has been completed, and the new encrypted disk will be mounted at the same file path as the unencrypted disk in the end.

How to use tccbsmig

usage: tccbsmig [-h] -f FILE [-V]

How to install tccbsmig on Linux

  1. Install the package use pip. On a Linux system, use pip3 to install:
    .
     pip3 install tccbsmig
    .
  2. On Linux pip install ... put scripts into ~/.local/bin and this is not on the default Debian or Ubuntu $PATH. To fix, you need to add ~/.local/bin to your $PATH:
    .
     export PATH="$HOME/.local/bin:$PATH"

How to prepare the JSON file

Attributes' value share the same rules of the APIs that used in this program if applicable.
API used in this program:
CreateDisks: https://intl.cloud.tencent.com/document/api/362/16312
AttachDisks: https://intl.cloud.tencent.com/document/api/362/16313
DetachDisks: https://intl.cloud.tencent.com/document/api/362/16316

An example of qualified JSON file is on the end of this doc.

JSON file structure explaination:

 Credentials - this attribute is used to store credentials
   SecrectID - your account SecrectID
    SecrectKey - your account SecrectKey
 CBS_Cases - stores all instances and block storages details
    Case_Name - the name of each case. You can modify case's name to whatever you want.
        InstanceDetail - instance Detail
            InstanceId (String)- instance ID of your instance
            InstancePublicIP (String)- public IP address of your instance
            InstanceName (String)- your instance's name
            Region (String)- the region your instance is in
            Zone (String)- the availability zone your instance is in
            ProjectId (Int)- the project ID of your instance
            Username (String)- username that used to log in your instance
            SSHKeyPath (String)- SSH Key file location
        CBSDetail - CBS detail
            DiskId (String)- the disk ID of your CBS
            DiskType (String)- the disk type of your CBS
            DiskSize (Int)- the size of your disk
            CBSPathOnCVM (String)- mount point of your disk
            FileSystem (String)- the file system your disk uses
            DiskName (String)- your disk name
            Tags (String)- tag of your disk. If you don't want to set this value, leave an empty string here.

JSON file example

{  
  "Credentials":{  
    "SecrectID":"AKID****************",  
    "SecrectKey":"1nKc*****************"  
  },  
  "CBS_Cases":{  
    "CBS_1":  
    {  
      "InstanceDetail":{  
        "InstanceId": "ins-3u***yg1",  
        "InstancePublicIP": "175.***.***.101",  
        "InstanceName":"ebs-en-test",  
        "Region": "ap-shanghai",  
        "Zone": "ap-shanghai-3",  
        "ProjectId": 111***1,  
        "Username": "ubuntu",  
        "SSHKeyPath": "/Path-to-SSHKey/SSHKey.dms"  
      },  
      "CBSDetail":{  
        "DiskId": "disk-q9***f8n",  
        "DiskType": "CLOUD_PREMIUM",  
        "DiskSize": 50,  
        "CBSPathOnCVM": "/data",  
        "FileSystem":"ext4",  
        "DiskName": "diskname",  
        "Tags": ""  
      }  
    },  
    "CBS_2":  
    {  
      "InstanceDetail":{  
        "InstanceId": "ins-3b***6e8",  
        "InstancePublicIP": "106.***.***.136",  
        "InstanceName":"un-en-test",  
        "Region": "ap-guangzhou",  
        "Zone": "ap-guangzhou-3",  
        "ProjectId": 111***1,  
        "Username": "ubuntu",  
        "SSHKeyPath": "/Path-to-SSHKey/SSHKey.dms"  
      },  
      "CBSDetail":{  
        "DiskId": "disk-ef***3pe",  
        "DiskType": "CLOUD_PREMIUM",  
        "DiskSize": 30,  
        "CBSPathOnCVM": "/data",  
        "FileSystem":"ext4",  
        "DiskName": "un-test",  
        "Tags": "[{\"Key\":\"TagKey\",\"Value\":\"TagValue\"}]"  
      }  
    }  
  }  
}  

For more information about Tencent Cloud, please visit: https://intl.cloud.tencent.com
Cloud Virtual Machine: https://intl.cloud.tencent.com/product/cvm
Cloud Block Storage: https://intl.cloud.tencent.com/product/cbs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tccbsmig-1.1b2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

tccbsmig-1.1b2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file tccbsmig-1.1b2.tar.gz.

File metadata

  • Download URL: tccbsmig-1.1b2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for tccbsmig-1.1b2.tar.gz
Algorithm Hash digest
SHA256 05ff4c6819f102f47597deedc4f3a8b9e3453d6cde6a0430aa039dc1774ee853
MD5 94c74ee62126ae55859216ec37591fc6
BLAKE2b-256 cdd4360398bcf0e1503b03edb2bdec52284fbb5ebbcd4f8b73c4abea13630c44

See more details on using hashes here.

File details

Details for the file tccbsmig-1.1b2-py3-none-any.whl.

File metadata

  • Download URL: tccbsmig-1.1b2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for tccbsmig-1.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6af45080333fecd1aadcce08be1cec0fe19e1c9c4bcd92f7a60d6d4bbae7984
MD5 6eb1796645157a2c656005965b545fb1
BLAKE2b-256 da5840d6c717ccc690a6b5023850c0e5f0d521db5642d0d12f4862dd0a8bf107

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page