Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Number of migration S3 using AzCopy for ​ Azure Storage series

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The previous article introduced two practical usage scenarios of AzCopy, it can be said that the operation of azure blob is absolutely quite simple, but now AzCopy is not limited to the operation of Azure, we can also use AzCopy to migrate the data of S3, which is definitely a useful tool for projects like AWS migrating Azure. However, at present, this function is only the preview version, so you should pay attention to verify the migration results and delete the source data.

There is a slight difference between the specific usage and blob in copying data, mainly in the way of authentication.

To use Azure to store authorization, use an Azure Active Directory (AD) or shared access signature (SAS) token.

To use AWS S3 for authorization, use the AWS access key and key access key

Therefore, when S3 authorizes, it directly uses AK/SK for authorization.

I won't go into details about how to create AWS AK/SK. Let's just take a look at how to set AK/SK so that azcopy can recognize it.

AzCopy actually reads the two fixed names in the environment variables directly, namely

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

Taking the PowerShell environment as an example, we can set environment variables in the following ways

$env:AWS_ACCESS_KEY_ID= "xxx"

$env:AWS_SECRET_ACCESS_KEY= "xxxx"

Just replace xxx with the actual value. The environment variables set by this method are only temporary variables, and closing the PowerShell session will disappear. This is also more in line with the actual situation, and this very sensitive information is certainly not suitable for long-term preservation.

We can use azcopy env to verify that the environment variables can be read correctly

As long as the value can be read here, it means that there is no problem with the setting of the environment variable.

We will directly use Azure AD to verify the target Azure, and we won't say much about the specific operation steps.

Let's look at how to migrate S3. AzCopy can support many kinds of S3 objects, including the following

Object

Catalogue

Bucket

Multiple bucket

The syntax is basically the same. Let's take a look at the migration of objects and directories.

Object migration

Azcopy copy 'https://xxx.s3.cn-north-1.amazonaws.com.cn/CBB_EC2AMAZ-R566F8E/CBB_Cloud/obs2s3000001/haozip_v5.9.8.exe'' https://xxx.blob.core.chinacloudapi.cn/aws/haozip_froms3.exe'

If the following error occurs, it proves that there is a problem with the setting of the environment variable.

The result of normal output is as follows:

You can see the data in blob right away.

The operation between the overall syntax and blob is still very consistent.

Directory migration

Directory migration and blob migration directory are basically the same, only need to add an additional parameter

Azcopy copy 'https://xxx.s3.cn-north-1.amazonaws.com.cn/CBB_EC2AMAZ-R566F8E/CBB_Cloud/obs2s3000001/15090887278028_sow.exe%24'' https://xxx.blob.core.chinacloudapi.cn/aws/'-- recursive=true

You can see that the whole catalog has moved here!

And so on, you can also migrate the entire bucket, which is too convenient for migration.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report