Why and How to Migrate Bulk Ubuntu EC2 from AWS to Azure?

9 minutes
Author Image By Tech Team

Last Updated: May 2, 2024

9 minutes

In the cloud computing environment, AWS (Amazon Web Service) and Microsoft Azure are the leaders that haven’t any other alternatives with such incredible benefits.

Of course, AWS is a great cloud provider that is used by most businesses to store, manage, and access their data remotely. However, since the time Microsoft came into existence, it has kicked off AWS by having its users.

In this blog post, you will dive into the concept of cloud computing and its providers like, which one you need to use, its benefits, and how to migrate from one platform to another.

Why Migrate from AWS to Azure? | What innovative does it offer?

AWS to Azure

From AWS and Azure, the latter is continuously gaining potency and going crazy each and every year. Here, are the following features that you can get from Microsoft Azure by using it as a Cloud computing provider.

1. Finest Hybrid Operation

Microsoft Azure is now easy to migrate from on-premises Active Directory (AD) to a hybrid deployment, especially for instance.

Azure offers a seamless move for the application and data in between on-premises and cloud environments. Consequently, organizations that are AWS consistently tend towards Microsoft Azure.

2. Affordable License cost

Generally, a user requires a new license to migrate an on-premises Windows server instance. But if you’re an existing user of Azure then you’re allowed to use the existing licenses for running workloads in the cloud.

In other words, Azure allows you to use the existing Windows Server and SQL Server on-premises licenses on the cloud needing any additional cost.

3. Global Reach

Microsoft Azure has extensive and global footprints as well as data centers in all available regions that provide better latency and a more strategic environment to it’s users.

4. Smooth Integration

If you do heavily rely on Microsoft services then technologies like Office 365, SharePoint, or Dynamics CRM, Azure’s seamless integration can be a significant advantage for you.

Moreover, if your only operating system is Windows, Linux, or Ubuntu then Microsoft has done everything possible for you by making its integration process flawless.

5. Access to develop Machine Learning Models without coding

The Machine Learning Studio of Microsoft Azure enables you to develop a machine learning model. The model can be built by a normal person who doesn’t have any coding (visual drag-and-drop) interface and skills for developing machine learning models.

6. IoT capabilities

In terms of the Internet of Things (IoT) Azure has strong capabilities and solutions, including IoT Hub, IoT Central, and Azure Sphere. Therefore, if your business focuses on IoT applications, Azure’s IoT functionality would be more suitable for you.

7. Advance Networking

At Azure, you can get advanced networking features such as Azure Virtual Network, Azure ExpressRoute for dedicated private connections, & Azure Traffic Manager for global load balancing. These features can be advantageous for complex networking requirements.

8. Azure Stack

In the Microsoft Azure stack, organizations are enabled to run Azure services on-premises or in a hybrid cloud environment with specific compliance or data sovereignty requirements.

9. Complete Manipulation

Azure’s hybrid cloud solution allows you to simplify complex and distributed environments across on-premises, multiple clouds, and edge. Furthermore, provides you with the functionality of remote management where you can manage your entire IT infrastructure and run Azure services from anywhere.

10. Multilingual Avail

Azure gives you the choice of utilizing a preferred language as well as a platform for building, debugging, deploying, and managing applications. Besides this, you are allowed to take advantage of Azure’s built-in support for integrated development environments.

11. Highest Growth Rate

In terms of Cloud computing service providers, Microsoft Azure has the highest utilization rate. In other words, Microsoft is the first cloud computing providers that carry the highest user rate which is approximately 64% while AWS has only a 36% user rate.

12. Container Service

Azure offers well-sound services including Azure Kubernetes Service (AKS) and Azure Container Instances (ACI). Additionally, virtualization, database, machine learning, and so on that make it a good choice for containerized applications & microservices architectures.

13. High Security

Azure provides a range of security features, including Azure Security Center, Azure Sentinel for security analytics, and compliance certifications such as ISO, SOC, and PCI DSS. Plus, organizations are allowed to use stringent security and compliance needs.

14. Better in Competition

Azure keeps its users productive, connected, and secure while adapting to new challenges. In just 12 months, Azure grew by more than 1,000 new capabilities, Innovative including AI, machine learning, virtualization, Kubernetes, and databases. In addition to this, azure is used and trusted by more than 20 million developers all over the universe.

15. Comprehensive Compliance Coverage

Microsoft Azure offers work from anywhere or on any device environment to its employees along with cloud-based desktop and app virtualization. Plus, delivers a minute-based collaboration, where you can get a scaleable, secure deploy, and fully optimized environment for Windows 10 and Office.

Automated File Migration from AWS to Azure Ubuntu Server? | A Stepwise Guidance

Let’s interpret the process of migrating files and folders from an AWS Ubuntu server to an Azure Ubuntu server along with the necessary code. Files and folder migration in-between different cloud platforms, such as AWS and Azure is a tedious process.

Furthermore, performing migrating tasks manually including zipping, copying, and unzipping files operation takes days or even weeks, depending on the size of the data. However, with a little scripting, we have made this migration process automated and more efficient.

Let’s move gradually—

Pre-Requisites for Migration:

  • Your Source and destination servers must have enough disk space to create, copy, and move zip files as well as folders.
  • Ensure that you have sufficient permissions to access and modify the files and folders on both servers including source and destination.
  • You need to establish an SSH connection in-between source server and destination servers by generating an RSA key pair and configuring authorized keys.

The step-by-step configuration to migrate from AWS to Azure

You need to follow all the mentioned steps to configure your Amazon Web Services to Microsoft Azure migration operation. Let’s initiate!

Step 1:

First, you have to generate an RSA Key Pair on the Source Server Open a terminal on the source AWS Ubuntu server and run the following command to generate an RSA key pair:


This command will generate two files: one is a private key (e.g., id_rsa) and another a public key (e.g.,

Step 2:

Next, you need to configure authorized Keys on the Destination Server, copy the contents of the file from the source server, and finally append it to the authorized_keys file on the destination Azure Ubuntu server.

Basically, this file is located at /root/.ssh/authorized_keys. However, if the file doesn’t exist there, you have to create it.

Step 3:

Now, you have to copy the zipping as well as unzipping scripts of the respective servers such as copy the script of the source AWS Ubuntu server and then the script of the destination Azure Ubuntu server. script:->


# Source folder where the folders to be zipped are located

# Destination folder where the zipped folders will be moved

# Remote server details

# Function to zip and move a folder
zip_and_move_folder() {

    # Print the folder being zipped
    echo "Zipping folder: $folder_name ,command->    zip -r "${zip_file}" "${folder_name}""

    # Zip the folder
    zip -r "${zip_file}" "${folder_name}"

    # Print the zipped file name
    echo "Zipped file: $zip_file"

    # Move the zipped folder to the destination folder
    mv "${folder_name}" "${dest_folder}"

    # Copy the zipped folder to the remote server
    echo "Copying $zip_file to $remote_server:$remote_dest_path"
    scp -r -i ~/.ssh/rsa1 "${zip_file}" "${remote_server}:${remote_dest_path}"

    # Remove the zipped folder from the local machine
    echo "REMOVING $zip_file "
    rm "${zip_file}"

copy_file_to_remote() {

    # Copy the file to the remote server
    echo "Copying $file_name to $remote_server:$remote_dest_path"
    scp -r -i ~/.ssh/rsa1 "${file_name}" "${remote_server}:${remote_dest_path}"

    # Move the file to the destination folder
    mv "${file_name}" "${dest_folder}"

# Traverse the source folder and zip/move each folder
for folder in "${source_folder}"/*; do
    if [ -d "$folder" ]; then
        zip_and_move_folder "$(basename "$folder")"
    elif [ -f "$folder" ]; then
        copy_file_to_remote "$(basename "$folder")"

This script will assist you in zipping the files and the folders in a specified source folder and then copying those zip files to the destination server. At last, moves the original folders and files to a specified destination folder on the source server. script:

# Folder to scan for zip files 
# Destination folder for moved zip files 
# Function to unzip and move a zip file 
unzip_and_move() { local zip_file="$1" 
# Unzip the file 
unzip "$zip_file" 
# Move the zip file to the destination folder
 mv "$zip_file" "$dest_folder" } 
# Traverse the scan folder and unzip/move each zip file
 for zip_file in "$scan_folder"/*.zip; do if [ -f "$zip_file" ]; then unzip_and_move "$zip_file" fi done

You can use this script to unzip the copied zip files on the destination server and move them to a specified destination folder as well.

Step 4:

From here, you can run the scripts on the source AWS Ubuntu server, and navigate them to the directory containing the script and lastly run the following command:


Additionally, with the help of this code, you can initiate the zipping and copying process.

For this, this script will scan the specified source folder and will zip each folder and file individually. Later, will copy the zip files to the destination server, and move the original folders and files to the specified destination folder on the source server.

Once the script has been completed, you have to log in to the destination Azure Ubuntu server and navigate to the directory containing the script.

And finally, run the following command:


By carrying this script, you can unzip the copied zip files and move them to the specified destination folder on the destination server.

Let’s Recap Before you Go!

This blog post will figure out the reasons why you need to migrate your files and folders to Azure from AWS. Plus, containing simple and on-the-point steps that will assist you in running the code for migration along with the scrips. Therefore, you can efficiently migrate files and folders from an AWS Ubuntu server to an Azure Ubuntu server. The automation offered by these scripts significantly reduces the time as well as effort required for manual migration and will make the process seamless and hassle-free.

Stay updated by signing up for our newsletter

Read our full Privacy Policy here.