Can't access Google Cloud Compute Instance External IP (boot fedora35) - google-cloud-platform

I have a nodejs app running inside it a vm instance.
I created a firewall rule opening port tcp:5000.
It works locally (inside vm) and I am able to verify the connection via
sudo wget http://localhost:5000
this gives status 200 ok.
when I replace the localhost with the vm external Ip address I get a connection time out.
I have tried most things I could get on the internet but now I am tired. Its my first time interacting with gcp so I guess it's expected.

The Network tags on the VM instance do not match your firewall rule inventory-controller-port. The Compute Engine Instance has these network tags http-server, https-server. To resolve this issue, these are your options.
Update the Firewall rule inventory-controller-port and add these network tags http-server, https-server. For more information, check this documentation about updating firewall rules.
Add additional network tags that you added on the Firewall rule inventory-controller-port on your existing VM. To know more check this documentation about Adding tags to an existing VM.

Related

Can't reach to an AWS EC2 instance website

I just launched a instance on AWS and I'm trying to open the website. So I copy the Public IPv4 address and paste it on my page. But it always returns This site can’t be reached 35.78.183.239 took too long to respond.
I've changed my firewall setting to access google chrome and set security groups HTTP, HTTPS. I can't figure out where the problem is. Any suggestions?
You didn't specify what webserver or AMI is on your EC2 instance.
You need to setup an AMI or manually install and setup a webserver for anything to show, otherwise the EC2 instance, while reachable, will not respond.
Make sure that ssh access is enabled and try ssh into the machine. If you can successfully login, then you know the instance is reachable and the problem is with your webserver software. This will help you debug.
What port is your application running on? When you enable HTTP and HTTPS it only allows ports 80 and 443 on the security group. This won't help if your application runs on a different port, so you'll need to add that to your security group to allow inbound traffic.

GCP VM ECONNREFUSED with completely open firewalls

I have a few gcp virtual machines setup with external IPs and http/https turned on.
Also added completely open firewall ingress/egress rules...
However when I try to reach the external IP it refuses to connect.
Here is the result of running netstat -a
Also when describing my instance I can verify it is running and setup on http/https firewall
I had to add the specific port to the request url. In my case it was
JSONRPC_URL=http://EXTERNAL-IP:8545

Install MobSF in GCP, can't access port 8000

I want to install MobSF to test every my mobile apps that I develop before.
Since I don't have many environment in my local PC, so I create a compute engine in GCP.
All installation is running well and completed.
My problem is, I can't access MobSF via external/public IP from GCP.
when I ping to my external IP, it's no problem.
I think this problem caused by firewall configuration that I must open port 8000.
But I don't know how to create correct firewall setting.
I was try to create before, but still failed.
If you simply want to open port 8000 to the world, you can create a firewall rule as below (considering you are using the default vpc):
gcloud compute firewall-rules create "allow8000" --allow=tcp:8000
--source-ranges="0.0.0.0/0" --description="Allow 8000 external"
Ref: https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create
Edit: if you want to do a more granular firewall control to specify only one compute engine (the one you mentioned) you need either use network tags or allow only the private IP of that instance.
Also, I just noticed that you've started the app with the loopback address. Have you tried to start it up to listen to all interfaces "0.0.0.0"?
It is more likely that you might have not checked the ‘Allow HTTP traffic’ box of Firewall while creating the Virtual machine. If so, please follow the below mentioned steps and then try accessing your application from the web browser.
Click on the VM name
In the VM instance details page, click on EDIT button
Select the ‘Allow HTTP traffic’ under firewalls option and save.

Lost access to Mongo running on Google Cloud VM and can't ssh to it

I have a mongo instance running on a google cloud VM and my application lost access to it overnight. I'm not being able to SSH to it and Cloud console is looking weird.
VM Image: bitnami-mongodb-3-2-1-1-r04-linux-debian-7-x86-64
It first says I don't have permission to access the instance console page. Eventhough I'm the owner of the project and I can see it once I close the modal.
Then when I try to SSH using the built-in SSH tool I first get the following message. I see I have a VPC setup so I'm not really sure if that is actually expected or not.
If I try the alternative method I then get the following:
Does anyone has any hint on what could be the issue?
UPDATE:
VPC Firewall settings are set to allow SSH and the target project is set for it this rule:
I also have an external static IP set for this VM.
Just yesterday I could connect to my mongo instance through port 27017 and it stoped working without touching any GPC configuration.
Based on the information you have provided, it would seem that your GCE VM instance is currently utilizing IAP (Identity-Aware Proxy).
With this in mind, any overviewing the error message you are receiving, it would seem that your firewall rules aren't allowing connections on the SSH port. There should be an ingress rule to allow traffic to the instance on TCP port 22 (SSH) on that VPC network.
Generally, this is automatically created by GCP, on the default network it is typically called "default-allow-ssh", but you can also manually create it in the VPC Network -> Firewall rules tab. Make sure it applies to the instance in question (either through "All targets" or a target tag that matches the instance). You can read more about GCP firewall rules in the documentation.
Likewise, make sure you have an external IP or that you are following one of the options described here.

How to Configure Angular2 on AWS

I've had success building the Angular2 Quickstart app on my local machine, but I'd like to jump forward to setting it up on an AWS instance. The issue is that I ssh into the instance and so the npm start command doesn't load the app into my local browser. Even the "External" addresses provided don't work, even with an elastic IP assigned and the corresponding port opened. I've also looked through the node_modules/lite-server files to update any necessary configuration changes, but I haven't found how to alter it properly.
Can anyone point me to some resources that can help me get started wit angular2 on AWS?
So, first, there are some differences between your localhost and the aws EC2 instance.
Your computer is a graphical computer with a browser, the ec2 vm is just a command line based linux server and has no browser installed on it.
npm start, just like "grunt someTask" has extra stuff built into the steps that wouldn't make sense on a linux server... i.e. automatically opening your browser window and doing live-reload for active development, etc.
the EC2 vm is a place where you want to treat it more like beta server or production server, meaning that you dont start and stop your app with npm start, instead you want to start it with node yourAppFile.js, and you are merely running it to see if it works. You don't develop here.
Also, the ec2 vm itself is guarded / protected by a security group, and that allows very few ports to be accessed from the outside world by default, so you've got to go edit the "inbound rules" of the security group and add a rule that essentially allows: "custom" --> "the node port" --> "your IP". Doing so will make it possible to connect to it using the vm-public-ip:port-of-node-app which will look something like this in your browser: 56.128.17.42:3000. And because you put your own IP in that rule, no other IP addresses would be able to load it in their browsers... just you. If you were to say "0.0.0.0/0" in the ip field, that allows all users anywhere to connect.
I would test with curl on your local machine to make sure it's up and running. You can do that with "curl http://localhost:3000/ (change 3000 to whatever port you are running on).
If that is working okay, you may have an issue with security groups. Go to the security group topic on the EC2 page and select the security group for your server and make sure that you have the port opened from your IP address (you can google "what is my ip" if you don't know it). You can just open it the whole world if you're not worried about security.