Creating a publicly accessible VM in GCP

Step 1 - Create a new VM - While Creating the VM

Allow HTTP and HTTPs firewall rule (if you plan to host a web app on there)

Pick the ephemeral IP - you can assign a public IP later - after the VM is created.

Step 2 - Create a Public, Static IP

Pick the standard networking tier (premium networking is defaulted - and costs more)

Note - Static IP addresses not attached to an instance or load balancer are billed at a higher hourly rate. Learn more 

Step 3 - Attach the IP to the VM created in step 1

Summary

That's it - you should now have a VM that you can both SSH into - as well as host a public facing website on.  The IP Address will be available on the console . If you want to access it via a custom DNS, that's fairly straightforward as well.

Why not use App Engine instead?

App engine should always be your first choice - but there are use cases where you need your own VM. The most common example is if you have two different runtimes (e.g. I needed a web app with a PHP front end and python backend). With app engine, only one runtime is supported at a time. In addition, you can only have ONE app engine instance within a project.

anuj

I am passionate about getting cloud solutions right the first time. I help customers transition to the public cloud with the appropriate security controls and guardrails. GCP, AWS and Azure Security Specialist. <a href="https://calendly.com/anujvarma/google-cloud-architect-initial-consultation">Initial Consultation</a>

Leave a reply

Your email address will not be published. Required fields are marked *