😀

AzCopy を使って Google Cloud Storage にあるオブジェクトを Azure Storage の

に公開

背景と目的

メガクラウドの一つを使っていて、会社の方針とやらで別のメガクラウドに移行しなければいけないケースに遭遇するようになってきました。その中の一つのタスクとしてオブジェクトストレージの移行は、割と多いタスクの一つなのではないかと思います。そこで今回は AzCopy を使って Google Cloud Storage にあるオブジェクトを Azure Storage の Blob コンテナに一括でコピーしてみました。

前提条件

  • AzCopy がインストール済みであること
  • Google Cloud Storage オブジェクトにアクセスできるサービスアカウントを作成しキーをローカルにダウンロード済みであること
bash
$ azcopy --version
azcopy version 10.14.0

Google Cloud Storage のオブジェクト

images フォルダと test.txt があります。

gcs2azureblob-azcopy-01.png

images フォルダの中には sample.png があります。

gcs2azureblob-azcopy-02.png

Google Cloud Storage の認証

bash
export GOOGLE_APPLICATION_CREDENTIALS=<サービスアカウントのキー>.json

AzCopy で Azure にログイン

bash
azcopy login

# 以下のメッセージが表示されます
INFO: Login succeeded.

AzCopy でオブジェクトをコピー

--recursive オプション付きでやってみました。

bash
azcopy copy \
  https://storage.cloud.google.com/mnrsdev \
  https://mnrlabo.blob.core.windows.net \
  --recursive=true

以下のような実行結果が出力され、ファイルが 2 つコピーされたようです。

bash
INFO: Scanning...
INFO: Authenticating to destination using Azure AD
INFO: Google Cloud Storage to Azure Blob copy is currently in preview. Validate the copy operation carefully before removing your data at source.
INFO: Authenticating to source using GoogleAppCredentials
INFO: azcopy: A newer version 10.16.2 is available to download

INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support

Job 9b8f0fc2-0924-ed4c-65a9-6068ad4e1fb2 has started
Log file is located at: /Users/testuser/.azcopy/9b8f0fc2-0924-ed4c-65a9-6068ad4e1fb2.log

0.0 %, 0 Done, 0 Failed, 2 Pending, 0 Skipped, 2 Total, 


Job 9b8f0fc2-0924-ed4c-65a9-6068ad4e1fb2 summary
Elapsed Time (Minutes): 0.0334
Number of File Transfers: 2
Number of Folder Property Transfers: 0
Total Number of Transfers: 2
Number of Transfers Completed: 2
Number of Transfers Failed: 0
Number of Transfers Skipped: 0
TotalBytesTransferred: 429
Final Job Status: Completed

Azure Storage の Blob コンテナの中身

mnrsdev というコンテナが作成され images フォルダと test.txt があります。

gcs2azureblob-azcopy-03.png

images フォルダの中には sample.png があります。

gcs2azureblob-azcopy-04.png

参考

https://learn.microsoft.com/ja-jp/azure/storage/common/storage-use-azcopy-google-cloud

https://learn.microsoft.com/ja-jp/azure/storage/common/storage-use-azcopy-authorize-azure-active-directory

Discussion