Skip to content

Instantly share code, notes, and snippets.

@premist
Created April 15, 2018 07:37
Show Gist options
  • Save premist/83e5a28747cb02eeda37d378d532e212 to your computer and use it in GitHub Desktop.
Save premist/83e5a28747cb02eeda37d378d532e212 to your computer and use it in GitHub Desktop.
$0.01/hour self-destructing VPN server on Google Cloud Platform
#!/bin/bash
GCP_PROJECT=my-gce-project
GCP_ZONE=asia-northeast1-b # Tokyo
GCP_MACHINE_TYPE=g1-small # f1-micro is also fine
VPN_NAME=my-vpn
VPN_PSK=somesufficientlylongpsk
VPN_USERS=myself:mysomesortofsecurepassword
set -ex
gcloud components install beta --quiet
gcloud beta compute instances create-with-container $VPN_NAME \
--project $GCP_PROJECT \
--zone $GCP_ZONE \
--machine-type=$GCP_MACHINE_TYPE \
--preemptible \
--container-privileged \
--container-image=premist/softethervpn:v0.0.1 \
--container-env=PSK=$VPN_PSK,USERS=$VPN_USERS
@premist
Copy link
Author

premist commented Apr 15, 2018

$0.01/hour doesn't include bandwidth cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment