Help Deploy Rust Rocket API To VM Instance

Good afternoon,

I've been experimenting with an api written in Rust/Rocket to test simple POST and GET requests. I've setup a new VM instance, made sure rust + cargo are installed, and I'm perfectly able to get data back. The API submits information to a mongo cloud instance setup, and I've verified that it's working as intended.

What I don't understand is why I can't access it externally from my local PC. I've opened up port 8000, I'm allowing ipv4 connections notated by (0.0.0.0/0) and enabled http + https. but I still am unable to get any data back from the GET request from postman (I get an ECONNREFUSED 35.209.199.242:8000 error). I've setup connectivity tests, which say that it's connected okay, but this is obviously not the case here.

I've tried just about everything here, but I am not sure what I'm missing. Any help would be appreciated. As otherwise I'll have to scrap the project and start over with flask/golang and deploy on digital ocean.

0 1 252
1 REPLY 1

If you have applied the default GCP HTTP and HTTPS network firewall rules, they only allow traffic on ports 80 and 443. To allow HTTP over port 8000 you'll need to create a specific firewall rule for that. You can add a rule from the cloud console under "VPC Network" -> "Firewall".