← All writing
Trade-offnetworkingazureaws

Why I looked at WireGuard instead of a cloud VPN

I wanted laptops and phones to reach private resources in Azure and AWS. The production-grade cloud VPNs cost over $100 a month before any device connects, and none of them gives phones single sign-on. WireGuard looked simpler, but it moves the hard parts to you.

2026-11-1611 min read
On this page6 sections

I wanted a simple way to connect my devices to private resources in the cloud. The devices were laptops and phones. The resources were things like an internal web app in a private network, with no public address.

The obvious answer was the VPN service of each cloud. I looked at Azure VPN Gateway and AWS Client VPN, and I did not like what I found. Then I read about WireGuard. This post explains what WireGuard is, why it looked better, and why I did not stop there.

I assessed plain WireGuard on paper, and I did not deploy it. The gaps were clear before a pilot, so a test setup would not change the decision. The config files in this post are examples, not copies of a real setup.

What I needed

The requirements were short:

  1. Laptops and phones connect to private resources in Azure and AWS.
  2. The connection works on mobile data and on home Wi-Fi, without extra steps.
  3. One broken server or one bad region does not cut off everybody.
  4. The cost stays low when nobody uses the connection.

Requirement 2 matters more than it looks. A phone on mobile data usually has no public IPv4 address. The mobile network puts it behind carrier-grade NAT (network address translation, where many devices share one public address). Over IPv4, nothing on the internet can start a connection to that phone. Many mobile networks also give the phone a public IPv6 address. But some networks block incoming IPv6 connections, and many cloud networks and home Wi-Fi networks still use only IPv4. So I could not depend on IPv6.

What the cloud VPNs offer

Both clouds have a managed point-to-site VPN. Point-to-site means each device connects on its own, not a whole office network.

Cost

You pay for the gateway every hour, even when no device connects. These are list prices for the India regions in November 2026:

OptionPer hourPer month
Azure Basic$0.036$26.28
Azure VpnGw1AZ$0.21$153.30
AWS Client VPN, 1 subnet$0.15$109.50
AWS Client VPN, 2 subnets$0.30$219.00
AWS, each connected device$0.05$36.50

A month is 730 hours here. The AWS price for each device applies only for the hours that the device stays connected. The last row shows a device that stays connected all month.

Azure still lists VpnGw1 at $0.19 an hour. But since 1 November 2025, Azure does not let you create new VpnGw1–5 gateways without zone support. So VpnGw1AZ is the smallest full option for a new setup.

Why not Azure Basic

Azure Basic costs much less, so I checked it first. It did not meet my needs:

  • No single sign-on. Sign-in with Microsoft Entra ID needs the OpenVPN protocol, and Basic does not support OpenVPN. Basic also does not support RADIUS. So every device, laptop or phone, needs a client certificate.
  • No zone redundancy. One zone failure can stop the gateway.
  • Not for production. Microsoft gives Basic only limited support and recommends it for dev-test only.

AWS Client VPN has no cheaper tier. Every endpoint supports SAML single sign-on, but only with the AWS desktop client. The next section explains what that means for phones.

High availability

High availability (HA) means the service keeps working when one part fails. Both services give some HA inside one region:

  • Azure: the AZ gateways spread their instances across availability zones. New gateways other than Basic must use them.
  • AWS: you link a second subnet in another availability zone. Each linked subnet costs the full hourly price, so the base cost doubles.

Neither service covers a full region failure. For that, you build a second gateway in a second region. Then you pay for two gateways and manage two client profiles.

Phones

Phones get the weakest support. This was the biggest problem for me.

  • Azure: on VpnGw1AZ and larger, sign-in with Entra ID needs OpenVPN and the Azure VPN Client. Microsoft documents that client for Windows and macOS only. Phones use the OpenVPN Connect app with a certificate. So you must create, install and renew a client certificate on each phone.
  • AWS: phones also use an OpenVPN app. AWS documents that an endpoint with SAML sign-in (single sign-on) does not accept OpenVPN-based clients. The AWS client that supports SAML runs on Windows, macOS and Linux. So a phone needs a certificate or a directory user name and password.

In both clouds, single sign-on works on laptops but not on phones.

What WireGuard is

WireGuard is a VPN protocol with a small code base. The original 2017 paper counts about 4,000 lines for the Linux kernel version, without the cryptographic code. The apps and tools for other platforms add more. The Linux kernel includes WireGuard from version 5.6. There are official apps for Windows, macOS, Linux, iOS and Android.

It is different from the cloud VPNs in four ways.

Keys, not certificates

Each device has a key pair, like SSH. The private key should stay on the device that uses it. You give the public key to the other devices. There is no certificate authority and no expiry date.

terminallaptop
$ umask 077
$ wg genkey | tee laptop.key | wg pubkey > laptop.pub

umask 077 makes the new key files readable only by your user.

Peers, not a server

WireGuard has no client and no server. Every device is a peer. Each peer has a list of the other peers it trusts. In practice, you often make one peer the hub, but the protocol does not require it.

AllowedIPs does two jobs

Each peer entry has an AllowedIPs list. WireGuard calls this cryptokey routing:

  • Outgoing: a packet to an address in the list goes to that peer.
  • Incoming: WireGuard accepts a packet from that peer only if its source address is in the list.

This is not a full firewall. The incoming check looks only at the source address. It does not limit the destinations or ports that the peer can reach. Also, the owner of the phone can edit AllowedIPs on the phone. So enforce access rules on the hub or on the resources, for example with nftables or a network security group.

One more detail: wg-quick, the usual tool to start a tunnel, adds operating system routes from AllowedIPs. WireGuard picks the peer only after a packet reaches its interface.

It stays quiet

WireGuard uses only UDP. It does not answer packets that do not come from a known key. A port scan cannot tell that WireGuard listens on the port.

A small example

Here is a minimal example that reaches a private network in the cloud. A small Linux VM in the cloud is the hub. One phone connects to it. This is not a complete setup. The list after the configs shows what else you need.

The hub config:

/etc/wireguard/wg0.conf (hub VM)ini
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <hub-private-key>

[Peer]
# my phone
PublicKey = <phone-public-key>
AllowedIPs = 10.8.0.2/32

The phone config:

phone.confini
[Interface]
Address = 10.8.0.2/32
PrivateKey = <phone-private-key>

[Peer]
PublicKey = <hub-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.8.0.0/24, 10.20.0.0/16
PersistentKeepalive = 25

Three lines in the phone config need an explanation:

  • Endpoint is the public address of the hub. Only the hub needs a public address. The phone starts the connection, so carrier-grade NAT is not a problem.
  • AllowedIPs sends the VPN range and the cloud network (10.20.0.0/16 here) through the tunnel. All other traffic uses the normal connection.
  • PersistentKeepalive sends a small packet every 25 seconds. This keeps the NAT entry on the mobile network open, so the hub can still reach the phone.

To move the config to the phone, you can show it as a QR code. The WireGuard app scans it.

terminalhub-vm
$ qrencode -t ansiutf8 < phone.conf

The QR code contains the private key of the phone. In this method, you create phone.conf on the hub, so the hub also holds that key. Remove the file after the phone scans it. A safer method is to create the key pair in the WireGuard app on the phone. Then you copy only the public key to the hub.

The hub VM must also forward traffic into the cloud network:

  1. Turn on IP forwarding in Linux (net.ipv4.ip_forward=1).
  2. On Azure, turn on IP forwarding on the network interface of the VM. On AWS, turn off the source/destination check on the instance.
  3. Add NAT on the VM, or add a route in the cloud network that sends 10.8.0.0/24 back to the VM.

You also need these:

  • Inbound UDP 51820 in the cloud firewall (a network security group or a security group) and in the host firewall.
  • Forwarding rules on the hub that let VPN traffic reach only the target services.
  • Private DNS, if users reach services by name. This example uses IP addresses only.
  • A network path from the hub to each cloud. An Azure or AWS range in AllowedIPs does not create that path. You need peering, a site-to-site VPN or a hub in each cloud.

A small VM for this costs much less than a cloud VPN gateway. An Azure B1s Linux VM in Central India costs about $8 a month. The public IP address and the disk add a few dollars.

Where plain WireGuard stops

On paper, WireGuard solved my problems. It is cheap, it is fast, and the phone apps are good. But each problem I had came back in a new form.

Every device needs manual changes

To add a device, you:

  1. Make a key pair on the device.
  2. Pick a free VPN address for it.
  3. Add a [Peer] entry on the hub and reload WireGuard.
  4. Put the hub public key, the endpoint and the routes on the device.

To remove a device, you remove its entry on every peer that knows it. With a hub, that is one file. In a full mesh, where every device connects to every other device, each new device means a change on all the others. Ten devices make 45 pairs of peers.

There is no central list of users, no single sign-on, and no access rules beyond AllowedIPs. If someone leaves, nothing removes their key for you.

The hub is a single point of failure

I wanted to remove the VPN gateway as a single point of failure. With plain WireGuard, the hub VM takes its place. If the VM stops, every device loses access. I must patch it, monitor it and back up its config.

I can run two hubs, but WireGuard does not fail over by itself. Each device then needs a second tunnel or a script to switch.

Device to device needs extra tools

WireGuard works through NAT when a device starts traffic to a peer that it can reach. The hub example works this way. But plain WireGuard does not discover public endpoints or coordinate NAT hole punching. Hole punching lets two devices behind NAT open a direct connection. So two phones behind carrier-grade NAT cannot reliably connect without additional tools. Without those tools, their traffic goes through the hub.

What I did next

WireGuard was the right protocol, but plain WireGuard was the wrong tool to run for many devices. Each manual step is a chance for a mistake, and nothing records who has access. To fix that, I would have to build key distribution, a user list and failover myself. Mature tools already do this.

I found that other people had the same problem, and tools already exist for it. Tailscale and Netbird both use WireGuard for the tunnels. They add the parts that plain WireGuard does not have:

  • a control plane that distributes public keys and peer information (each device still creates its own private key)
  • sign-in with an identity provider, on phones too
  • access rules for each user and group
  • NAT traversal, with relays when a direct connection fails
[networking][azure][aws]

Written by Porvinder Singh. I work on cloud infrastructure and write about it here. More about me →