Cloud VMs and wg-easy

Create a VM on Google Cloud

Create an Ubuntu server with a public IPv4 in your own Google Cloud account. Follow the console steps, connect from Mobile SSH, then install wg-easy as a separate task.

These instructions use the provider's console. The published VPN Setup plugin combines cloud creation, wg-easy installation and client import on compatible Android builds. You can also create the VM here and use its console/existing-server path, or install manually. Console setup needs no cloud API credentials in Mobile SSH. AWS EC2 remains a console-only provisioning option for VPN Setup; equivalent iOS automation is not established.

Check plugin availability

Open the provider console — Google Cloud

Before you start

  • Activate billing and check regional VM, disk and public-IP quotas. Review the displayed price before creating resources; do not assume a free tier or a particular plan is available.
  • Use Ubuntu 24.04 LTS with at least 1 GB RAM and 20 GB storage for this setup, or a larger provider minimum. Match the CPU architecture to the image. This is the guide's baseline, not a universal wg-easy minimum.
  • Keep an SSH private key in Mobile SSH and upload only its public key. Ed25519 works with the current Android and iOS clients; Lightsail's RSA import and iOS workaround are covered in its steps. Record your current public IPv4 followed by /32 as the SSH source, or use your approved management CIDR.

Network rules for this setup

  • Allow inbound TCP 22 from the management CIDR. Remove broader SSH allow rules if they are not required; adding a narrow rule does not automatically cancel a wider one. Update the source when your phone's public address changes.
  • For the later VPN step, allow inbound UDP 51820 from VPN-client networks; roaming clients may need 0.0.0.0/0. Configure IPv6 rules deliberately if you enable IPv6.
  • Keep public TCP 51821 closed. The wg-easy admin interface will bind to server loopback and be reached through SSH forwarding.
  • Permit the necessary outbound DNS, package/container downloads and VPN traffic. Check both cloud and guest firewalls; preserve provider storage and essential ICMP rules.

Create the server and connect

  1. Select or create a Google Cloud project, enable billing, and enable the Compute Engine API. Open Compute Engine → VM instances → Create instance.

    Provider instructions
  2. Name the VM and choose its region, zone and a machine with at least 1 GB RAM. Under OS and storage → Change, select Ubuntu → Ubuntu 24.04 LTS and at least 20 GB storage.

    Provider instructions
  3. Reserve a regional static external IPv4 in the VM’s region. In the VM’s Networking settings, select the intended VPC/subnet and choose that address for the network interface’s external IPv4. The VPC must have a default internet route; create a suitable network and subnet if your project has none.

    Provider instructions
  4. In the VM’s SSH-key settings, add your app’s public key with mobileuser as its username comment: ssh-ed25519 AAAA… mobileuser. If your project enforces OS Login, use that flow and its assigned POSIX username instead; metadata keys do not override it.

    Provider instructions
  5. Add a network tag such as wg-vpn. Create ingress firewall rules targeting that tag for the shared TCP 22 and UDP 51820 access. Restrict SSH to your phone’s public IPv4 and leave TCP 51821 closed.

    Provider instructions
  6. Finish reviewing the VM configuration and select Create. Wait until the instance is running, then record its external IPv4 and the SSH username selected above. Do not assume the username is ubuntu.

    Provider instructions
  7. Save the server in Mobile SSH

    Open Servers, add a server and fill in these values. Select the credential containing the matching private key. Use the username you configured if it differs from the guide's example.

    Host
    The VM's public IPv4 from the provider console
    Port
    22
    Username
    mobileuser
    Authentication
    The matching SSH private-key credential

    Obtain the SSH host-key fingerprint through the provider's trusted console or boot logs and compare it before trusting the connection. On Android, disable automatic acceptance of new identities if you want to review first use. Investigate changed-key warnings before replacing a saved identity. SSH keys and identity checks

  8. Install wg-easy as a separate step

    First confirm the saved server opens a terminal and your login has root or sudo access. Then follow the shared wg-easy installation guide: Docker, a pinned container, private administration over SSH, client creation and VPN verification. The installer needs SSH access, not your cloud API secret.

    Continue to the wg-easy installation steps

Optional API credentials for VPN Setup

Skip this section for console setup. The published VPN Setup plugin uses these credentials for its ten supported cloud providers on compatible Android builds; its AWS adapter uses Lightsail, not EC2. The EC2 credential notes describe future automation only. These permission lists are guidance, not live-tested minimum policies for every provider or account.

  1. For VPN Setup API provisioning, use a dedicated service account with project-scoped Compute Instance Admin (v1), Compute Network Admin and Compute Security Admin roles, or narrower equivalents. Compute Network Admin cannot create firewalls. If attaching a VM service account, also grant Service Account User on it. The automatic adapter uses metadata SSH keys and disables OS Login on its VM; if your organization requires OS Login, use an approved console configuration instead.

    Provider instructions
  2. If supported automation needs a JSON key and organization policy permits it, open IAM & Admin → Service accounts → Keys → Add key → Create new key → JSON. Supply the project ID and JSON through protected native settings; never bypass a key restriction.

    Provider instructions

Enter credentials only in the protected native form; credential entry and approvals require the screen. Native code authenticates with approved provider endpoints, without passing cloud secrets to the VM or plugin worker. Do not put secrets into voice prompts or terminal commands. Use the narrowest supported scope, record expiry, and revoke credentials you no longer need.

Delete resources you no longer need

Stopping the VM, canceling a setup job or removing a Mobile SSH profile does not delete cloud resources or guarantee that charges stop. Keep resource IDs until deletion is confirmed, and retain unrelated resources.

  1. Delete the VM and review whether its boot and data disks are deleted or retained; remove unwanted retained disks and snapshots.

    Provider instructions
  2. Release the reserved external IPv4 separately. Deleting the VM does not release a reserved address.

    Provider instructions

Cloud VMs and wg-easy