Skip to main content

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

--src-cloud

FLEXIFY_ENGINE_SRC_CLOUD

(required) Source cloud provider code. See providers.json for complete list of supported cloud providers and their codes.

Most commonly used: AWS, AZURE, GCP, ALI, B2_S3, WASABI.

--src-bucket

FLEXIFY_ENGINE_SRC_BUCKET

(required) Source bucket or container name.

--src-prefix

FLEXIFY_ENGINE_SRC_PREFIX

(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.

--src-key-id

FLEXIFY_ENGINE_SRC_KEY_ID

(required) Source cloud HMAC Access Key ID or Azure Storage account name.

--src-secret-key

FLEXIFY_ENGINE_SRC_SECRET_KEY

Source cloud HMAC Secret Access Key or Azure Storage Account key.

--src-sas-token

FLEXIFY_ENGINE_SRC_SAS_TOKEN

Source cloud Azure SAS signature (can be used instead of Azure Storage Account key).

--src-session-token

FLEXIFY_ENGINE_SRC_SESSION_TOKEN

(optional) Source AWS STS session token if temporary AWS credentials are used. Only for S3.

--dst-cloud

FLEXIFY_ENGINE_DST_CLOUD

(required) Destination cloud provider code.

--dst-bucket

FLEXIFY_ENGINE_DST_BUCKET

(required) Destination cloud’s bucket or container name.

--dst-prefix

FLEXIFY_ENGINE_DST_PREFIX

(optional) The prefix to be prepended to each object key in the destination. To keep object keys unchanged, specify the same dst_prefix as src_prefix.

--dst-key-id

FLEXIFY_ENGINE_DST_KEY_ID

(required) Destination cloud HMAC Access Key ID or Azure Storage account name.

--dst-secret-key

FLEXIFY_ENGINE_DST_SECRET_KEY

Destination cloud HMAC Secret Access Key or Azure Storage Account key.

--dst-sas-token

FLEXIFY_ENGINE_DST_SAS_TOKEN

Destination cloud Azure SAS signature (can be used instead of Azure Storage Account key).

--dst-session-token

FLEXIFY_ENGINE_DST_SESSION_TOKEN

(optional) Destination AWS STS session token if temporary AWS credentials are used. Only for S3.

--streams

FLEXIFY_ENGINE_STREAMS

(optional) The maximum total number of objects (connections) that are migrated/processed simultaneously.

Default is 32.

--buf-size

FLEXIFY_ENGINE_BUF_SIZE

(optional) Buffer size for upload and download streams in bytes.

Default is 2097152.

--multipart-concurrency

FLEXIFY_ENGINE_MULTIPART_CONCURRENCY

(optional) Maximum number of object parts that are uploaded simultaneously.

Default is 16.

--multipart-limit

FLEXIFY_ENGINE_MULTIPART_LIMIT

(optional) Minimum size of an object to be migrated in multiple parts using multipart upload (in bytes, or valueK, valueM, valueG, valueT).

Default is 256M.

--multipart-part-size

FLEXIFY_ENGINE_MULTIPART_PART_SIZE

(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.

--strict-consistency-check

FLEXIFY_ENGINE_STRICT_CONSISTENCY_CHECK

Enables strict consistency check that calculates and compares checksums at all stages of migration.

Default: relaxed consistency check

--mode

FLEXIFY_ENGINE_MODE

(optional) Defines if objects should be deleted from source after successful migration (copy / move).

Default is copy.

--comparison

FLEXIFY_ENGINE_COMPARISON

(optional) Defines if HeadObject (probe) or listing objects (list, list-only) is used to check if an object exists in the destination. The list mode can still perform HeadObject if the decision is not certain from information in the objects list. list-only never preforms HeadObject.

Migration with list comparison method may fail if a storage provide returns objects in a non-standard objects.

Default is probe.

--conflict-resolution

FLEXIFY_ENGINE_CONFLICT_RESOLUTION

(optional) Specified behavior (overwrite or skip) in case when an object with such key already exists in the destination (source / destination / newer).

Default is destination (never overwrite).

--no-hash-match

FLEXIFY_ENGINE_NO_HASH_MATCH

(optional) Disables skipping migration of an object when there is already such object in the destination with the same hash or ETag.

--src-endpoint

FLEXIFY_ENGINE_SRC_ENDPOINT

(optional) Custom endpoint for the source cloud provider.

--src-default-region

FLEXIFY_ENGINE_SRC_DEFAULT_REGION

(optional) Custom region to be used in a signature for requests to the source cloud provider.

--dst-endpoint

FLEXIFY_ENGINE_DST_ENDPOINT

(optional) Custom endpoint for the destination cloud provider.

--dst-default-region

FLEXIFY_ENGINE_DST_DEFAULT_REGION

(optional) Custom region to be used in a signature for requests to the destination cloud provider.

--dry-run

FLEXIFY_ENGINE_DRY_RUN

Dry run the migration by performing all the checks but not writing or deleting any data.

--no-src-ssl

FLEXIFY_ENGINE_NO_SRC_SSL

Use HTTP instead of HTTPS when connecting to the source cloud.

--no-dst-ssl

FLEXIFY_ENGINE_NO_DST_SSL

Use HTTP instead of HTTPS when connecting to the destination cloud.

--src-force-path-style

FLEXIFY_ENGINE_SRC_FORCE_PATH_STYLE

Use path-style when addressing the source bucket.

--dst-force-path-style

FLEXIFY_ENGINE_DST_FORCE_PATH_STYLE

Use path-style when addressing the destination bucket.

--auto-restore-if-archived

FLEXIFY_ENGINE_AUTO_RESTORE_IF_ARCHIVED

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.

--restore-tier

FLEXIFY_ENGINE_RESTORE_TIER

(optional) Retrieval tier for to be used when retrieving objects from archival storage classes (bulk / standard / expedited).

Default is bulk.

--restore-days

FLEXIFY_ENGINE_RESTORE_DAYS

(optional) Lifetime of the active copy of an object after retrieval from archive, in days.

Default is 7.

--restore-max-size

FLEXIFY_ENGINE_RESTORE_MAX_SIZE

(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.

--throttling-bytes
--throttling-requests

FLEXIFY_ENGINE_THROTTLING_BYTES
FLEXIFY_ENGINE_THROTTLING_REQUESTS

(optional) Maximum number of bytes (K, M, G, or T) and/or requests sent to the destination storage per period.

Default: no throttling.

--throttling-period-ms

FLEXIFY_ENGINE_THROTTLING_PERIOD_MS

(optional) Period for throttling rate calculations in milliseconds.

Default is 1000 ms.

--sqs-arn

FLEXIFY_ENGINE_SQS_ARN

ARN of Amazon SQS queue that receives object change notification from Amazon S3 and is used for event-based sync.

--sqs-key-id

FLEXIFY_ENGINE_SQS_KEY_ID

Key ID to access the Amazon SQS queue.

--sqs-secret-key

FLEXIFY_ENGINE_SQS_SECRET_KEY

Secret Key to access the Amazon SQS queue.

--report-level

FLEXIFY_ENGINE_REPORT_LEVEL

Report level for migration reports. One of ALL, FAILED, NOT_SKIPPED, NONE (default).

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]...

src_cloud

(required) Source cloud provider code.

src_bucket

(required) Source cloud’s bucket or container name.

src_prefix

(optional) Objects key prefix in the source bucket or container.

dst_cloud

(required) Destination cloud provider code.

dst_bucket

(required) Destination cloud’s bucket or container name.

dst_prefix

(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.