fl migrate
With flexify-engine package or flexifyio/migrate Docker image you can migrate data between buckets or containers of the same or different cloud providers from a command line.
Install on Linux (DEB and RPM), then runfl migrate --help to display the list of proxy options.
Usage
fl migrate [options]...
Options
Additional options are located in this page: Common options
Command line option | Environment variable | Description |
|---|---|---|
|
| (required) Source cloud provider code. See Most commonly used: |
|
| (required) Source bucket or container name. |
|
| (optional) Objects prefix in the source bucket or container. Only objects with keys starting with the specified prefix will be migrated, and written to the destination without that prefix. |
|
| (required) Source cloud HMAC Access Key ID or Azure Storage account name. |
|
| Source cloud HMAC Secret Access Key or Azure Storage Account key. |
|
| Source cloud Azure SAS signature (can be used instead of Azure Storage Account key). |
|
| (optional) Source AWS STS session token if temporary AWS credentials are used. Only for S3. |
|
| (required) Destination cloud provider code. |
|
| (required) Destination cloud’s bucket or container name. |
|
| (optional) The prefix to be prepended to each object key in the destination. To keep object keys unchanged, specify the same |
|
| (required) Destination cloud HMAC Access Key ID or Azure Storage account name. |
|
| Destination cloud HMAC Secret Access Key or Azure Storage Account key. |
|
| Destination cloud Azure SAS signature (can be used instead of Azure Storage Account key). |
|
| (optional) Destination AWS STS session token if temporary AWS credentials are used. Only for S3. |
|
| (optional) The maximum total number of objects (connections) that are migrated/processed simultaneously. Default is 32. |
|
| (optional) Buffer size for upload and download streams in bytes. Default is 2097152. |
|
| (optional) Maximum number of object parts that are uploaded simultaneously. Default is 16. |
|
| (optional) Minimum size of an object to be migrated in multiple parts using multipart upload (in bytes, or Default is 256M. |
|
| (optional) Default/minimum size of an object part for multipart upload. The actual part sizes might be larger for very large object is the specified part size would result in exceeding the limit of 10,000 parts. Default is 64M. |
|
| Enables strict consistency check that calculates and compares checksums at all stages of migration. Default: relaxed consistency check |
|
| (optional) Defines if objects should be deleted from source after successful migration ( Default is |
|
| (optional) Defines if HeadObject ( Migration with list comparison method may fail if a storage provide returns objects in a non-standard objects. Default is |
|
| (optional) Specified behavior (overwrite or skip) in case when an object with such key already exists in the destination ( Default is |
|
| (optional) Disables skipping migration of an object when there is already such object in the destination with the same hash or ETag. |
|
| (optional) Custom endpoint for the source cloud provider. |
|
| (optional) Custom region to be used in a signature for requests to the source cloud provider. |
|
| (optional) Custom endpoint for the destination cloud provider. |
|
| (optional) Custom region to be used in a signature for requests to the destination cloud provider. |
|
| Dry run the migration by performing all the checks but not writing or deleting any data. |
|
| Use HTTP instead of HTTPS when connecting to the source cloud. |
|
| Use HTTP instead of HTTPS when connecting to the destination cloud. |
|
| Use path-style when addressing the source bucket. |
|
| Use path-style when addressing the destination bucket. |
|
| Automatically initiate restore/retrieval/rehydration process if an object to be migrated is in an “archival” storage class such as S3 Glacier and S3 Glacier Deep Archive. |
|
| (optional) Retrieval tier for to be used when retrieving objects from archival storage classes ( Default is |
|
| (optional) Lifetime of the active copy of an object after retrieval from archive, in days. Default is 7. |
|
| (optional) The limit on the maximum total size of restored objects during the migration. The value can be provided in bytes or in the valueK, valueM valueG, or valueT notation. Default is no limit. |
|
| (optional) Maximum number of bytes (K, M, G, or T) and/or requests sent to the destination storage per period. Default: no throttling. |
|
| (optional) Period for throttling rate calculations in milliseconds. Default is 1000 ms. |
|
| ARN of Amazon SQS queue that receives object change notification from Amazon S3 and is used for event-based sync. |
|
| Key ID to access the Amazon SQS queue. |
|
| Secret Key to access the Amazon SQS queue. |
|
| Report level for migration reports. One of |
Shortcut syntax
Instead of specifying migration source and destination via parameters or environment variables, a shortcut syntax can be used:
fl migrate \
<src_cloud>://<src_bucket>/<src_prefix> \
<dst_cloud>://<dst_bucket>/<dst_prefix> \
[options]...
| (required) Source cloud provider code. |
| (required) Source cloud’s bucket or container name. |
| (optional) Objects key prefix in the source bucket or container. |
| (required) Destination cloud provider code. |
| (required) Destination cloud’s bucket or container name. |
| (optional) Objects key prefix in the destination bucket or container. |
Providers
You can find list of supported providers and their codes in the providers.json file:
cat /etc/flexify/providers.json | jq '.providers[] | {code, defaultEndpoint}'
or
docker run --rm --entrypoint cat flexifyio/migrate /etc/flexify/providers.json | jq '.providers[] | {code, defaultEndpoint}'
Examples
Migrate data
This command will migrate data from AWs bucket peteramazon to Azure container peterazure.
fl migrate AWS://peteramazon AZURE://peterazure \
--src-key-id <sourceAccessKeyID> --src-secret-key <sourceSecretKeyID> \
--dst-key-id <azureStorageAccountName> --dst-secret-key <azureStorageAccountKey>
Migrate data with the Docker container
Alternatively, you can run the migration using the flexifyio/migrate Docker image:
docker run flexifyio/migrate AWS://fl-bucket1 AWS://fl-bucket2 \
--src-key-id AKIAYSDZY5MDXL2MZYUG --src-secret-key <secret key> \
--dst-key-id AKIAR46B3ATBCD2SKQFH --dst-secret-key <secret key>
Run continues notification-based sync
This command will read event from the specified Amazon SQS queue and migrate all objects that had been added or modified:
fl migrate AWS://fl-src-bucket AWS://fl-dst-bucket \
--src-key-id AKIAR46B3ALBCD2SKQGD --src-secret-key <src secret key> \
--dst-key-id AKIAYSDZI5MDSBS7YYG2 --dst-secret-key <dst secret key> \
--sqs-arn arn:aws:sqs:<SQS region>:<AWS account ID>:<SQS queue name> \
--sqs-key-id AKIAR46B3ALBEXYWPZU2 --sqs-secret-key <SQS secret key>
Run continues event-based sync via Docker Compose
Create docker-compose.yaml with the following content:
services:
engine:
image: flexifyio/migrate
volumes:
- $PWD/reports/:/var/lib/flexify/engine/migration_reports/
- $PWD/logs/:/var/log/flexify/engine/
environment:
FLEXIFY_ENGINE_SRC_CLOUD: AWS
FLEXIFY_ENGINE_SRC_BUCKET: your-source-bucket
FLEXIFY_ENGINE_SRC_KEY_ID: AKIAYSDZI5MDSBS7YYG2
FLEXIFY_ENGINE_SRC_SECRET_KEY: <src secret key>
FLEXIFY_ENGINE_DST_CLOUD: GCP
FLEXIFY_ENGINE_DST_BUCKET: your-destination-bucket
FLEXIFY_ENGINE_DST_KEY_ID: GOOGYQR65JHYGIXZSCED
FLEXIFY_ENGINE_DST_SECRET_KEY: <dst secret key>
FLEXIFY_ENGINE_STREAMS: 32
FLEXIFY_ENGINE_CONFLICT_RESOLUTION: source
FLEXIFY_ENGINE_NO_HASH_MATCH: true
FLEXIFY_ENGINE_SQS_ARN: arn:aws:sqs:us-east-1:<account>:<queue-name>
FLEXIFY_ENGINE_SQS_KEY_ID: AKIAYSDZI5MDSBS7YYG2
FLEXIFY_ENGINE_SQS_SECRET_KEY: <sqs secret key>
FLEXIFY_ENGINE_MIGRATION_REPORT_DIRECTORY: /var/lib/flexify/engine/migration_reports/
FLEXIFY_ENGINE_REPORT_LEVEL: ALL
LOGS_DIRECTORY: /var/log/flexify/engine/
FLEXIFY_ENGINE_LOG_LEVEL: INFO
restart: unless-stopped
Then run with docker compose up -d. The bucket should be configured to send notification to the SQS queue you’ve specified in the configuration.
Reports and logs will be saved to directories under the current directory.