Creating a Free Tier VM
- Create a VPC and subnet with IPv6 enabled.
- Configure VPC Firewall.
- Create Instance Template for reuse.
- Select Debian amd64 image, which avoids Snap from Ubuntu and OOM problems with
dnf
. - Change disk type to standard persistent disk.
- Select e2-micro instance type and one of the Free Tier-eligible regions.
- Select Debian amd64 image, which avoids Snap from Ubuntu and OOM problems with
- Create instance from template.
- Select “no service account”, unless you need to assign IAM permissions.
- Unselect custom device name of boot disk.
- Enable “block project-wide SSH keys” and “deletion protection” if you want to.
Instance template
- Select e2-micro machine type.
- Change disk type to standard and size to 30 GB.
- Select the OS image you want.
- Select VPC and subnet.
- Select “IPv4 and IPv6” IP stack.
- If you prefer not to log in via the console, add SSH keys in Security with one word “comment” as the username.
KEY_VALUE USERNAME
Network egress
The default is “1 GB of outbound data transfer from North America to all region destinations (excluding China and Australia) per month.” Avoid China and Australia destinations, for example, derp5-all.tailscale.com
in Australia.
To get 200 GB of free internet data transfer, switch your instance to use the Standard Network Service Tier. Note that Standard tier is not available for IPv6-only or dual-stack instances.
If you still want to switch to Standard tier, the guide is available at https://cloud.google.com/network-tiers/docs/set-network-tier. See https://cloud.google.com/network-tiers/pricing and https://cloud.google.com/vpc/network-pricing?hl=en#tg0-t4 for latest information. This free tier was added in October 2023.
Swap
Caution
It isn’t recommended to use RHEL-compatible Linux distributions on an e2-micro instance.
1 GB memory isn’t enough for dnf upgrade
with many repos (per Bug 1907030). Set up swap space as follows.
sudo -i
umask 077
dd if=/dev/urandom of=/.swapfile count=4096 bs=1MiB
mkswap /.swapfile
echo "/.swapfile none swap sw 0 0" >> /etc/fstab
swapon -a
echo "vm.swappiness = 10" > /etc/sysctl.d/90-vm.conf
sysctl -p /etc/sysctl.d/90-vm.conf
Before dnf upgrade
, remove unused packages to save time.
dnf config-manager --disable google-cloud-sdk
dnf install -y tmux
tmux
rpm -e google-cloud-sdk