How to Clone Your AWS VPC into an Azure VNet

Why Clone Your Network Across Clouds?

Picture this: You’ve spent months—maybe even years—crafting the perfect AWS VPC. Subnets? Check. Routing tables? Absolutely. Internet connection? Of course! But disaster strikes and now your recovery plan calls for spinning up your system not in AWS, but over in Azure. Cue the panic—or at least, it used to. Because transferring your VPC setup to Azure as a virtual network (VNet) isn’t just desirable, it can be your saving grace in a real-world recovery scenario.

So, let’s walk through how (and why) to do it, so your backup plan actually includes restoring full connectivity, instead of just the raw data.

Why Use N2W?

If you’re hoping to grab your VPC as ready-to-use code directly from AWS… yeah, not so much. There’s no magic “Export as Infrastructure-as-Code” button. Enter N2W, your new best friend for serious cross-cloud.

Step 1: Export Your VPC to JSON

  1. Using N2W, navigate to Accounts and then find the AWS account with your VPC.
  2. Click “Clone Network Entities,” and export your VPC details as a CloudFormation template (in good old JSON format). Now you have every subnet, routing table, and internet gateway carved.
  3. Always double-check the JSON: make sure it actually reflects all the crucial bits of your network.

Step 2: Transform Your JSON to Terraform

Now for the fun part: taking your AWS-extracted network config and making it Azure-ready using Terraform. Think of Terraform as a universal translator, keeping your cloud infrastructure sane when switching vendors.

This takes a bit of know-how (and maybe some trial and error), but with the right steps, it’s straightforward:

  • Initialize Terraform: New to the Azure CLI? Open your cloud shell. Remember, this environment is ephemeral—meaning every mistake is a hard lesson in starting from scratch. No shame, we’ve all cursed at stateless shells before.
  • Create, Name, and Fill Your Plan File: Call it what you want (“PlanTerraform.tf” keeps it simple) and paste in your beautifully-converted Terraform template.
  • Run the Commands:
    • terraform init
    • terraform plan
    • terraform apply

Got an error?

Don’t worry. They can happen and, as Cynthia demos in the video, they’re easy to fix. Maybe you named your file wrong or missed a bracket. Just delete the bad plan, fix your template, and reapply. No drama, no worries.

Check Yourself: Verifying Your Shiny New VNet

You did it—the network deployed in Azure! Now it’s time to make sure your new VNet truly matches your old VPC, right down to the subnet.

Hop into Azure’s Dashboard, visit your virtual networks, and check the topology. Does that network map look just like AWS? Good! Do a quick sweep of properties and routing. Your new VNet should echo your original VPC, setting you up perfectly for recovery.

The Real Payoff: Seamless Recovery When It Counts

True disaster recovery isn’t just about having backups, but also about restoring to an environment that actually works. With a matching VNet in Azure, you can quickly spin up your recovered instances with network settings they recognize. No surprises, no last-minute firefighting.

So next time disaster looms and you need to switch clouds, take heart! With a dash of Terraform and a sprinkle of N2W magic, you’ll be sipping coffee while everyone else is scrambling.

Sleep easy—the (cross-cloud) force is strong with this one.

N2W icon in white

Get the monthly TL;DR newsletter