How to enable access to a web service hosted on GCP VM instance - web-services

I built a web app, that runs and listens on port 5000 using .netcore (default app in VS).
I created a VM instance on GCP, and allowed http and https traffic in the configuration.
I ran the app, and used the exteral ip(which I succeeded to ping) to access it from the browser:
http://:5000
But I got no response, this should have opened the site.
I added a firewall rule to allow traffic but still didn't help:
I'm sure many people encountered this, any help?

I have the same opinion as #Iñigo, it could be the firewall.
You can create the rule with the following command:
gcloud compute --project=my-project firewall-rules create rule-for-netcore --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:5000 --source-ranges=0.0.0.0/0
The output should be something like:
Creating firewall...⠹Created [https://www.googleapis.com/compute/v1/projects/my-project...l/firewalls/rule-for-netcore].
Creating firewall...done.
NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED
rule-for-netcore default INGRESS 1000 tcp:5000 False
Edit 1
Also you need to open the port in your windows firewall:
From the Start menu, click Control Panel, click System and Security, and then click Windows Firewall. Control Panel is not configured for 'Category' view, you only need to select Windows Firewall.
Click Advanced Settings.
Click Inbound Rules.
Click New Rule in the Actions window.
Click Rule Type of Port.
Click Next.
On the Protocol and Ports page click TCP.
Select Specific Local Ports and type a value something like 5000-5010 (this is only an example you need to add the ports needed)
Click Next.
On the Action page click Allow the connection.
Click Next.
On the Profile page click the appropriate options for your environment.
Click Next.
On the Name page enter a name of like “Open port for test”
Click Finish.
Restart the Instance.
At the end you would see the rule like this:
You can consult the following link for more information.

The firewall is dropping your traffic.
You should open port 5000, not http(port 80) or https(port 443).

Related

This site can’t be reached - refused to connect. - Google cloud

No matter what I do I will always get this come up when trying to load the website. - (This site can’t be reached - 35.188.89.14 refused to connect.)
I've tried creating different instances using various methods. I am doing everything that I have always done but no matter what I'm stuck in receiving this.
I don't know where to turn or whats causing it, I'm completely stuck.
In addition to the comment of #Ferregina Pelona, I elaborate the configuration of the Firewall section configuration, you need to configure this firewall to permit HTTP or HTTPS traffic to the VM or instance, use this public document for Create a VM instance from a public image
#Corey Mason I know you're new to GCP so I tried to create a step by step how you configure the HTTP or HTTPS, and also you can use the link above for more details of the steps.
Open GCP web console
Search Compute Engine
Locate your VM instance > Click your VM instance
Click Edit Button from the top
Locate "Networking" > Firewalls > Check 'Allow HTTP traffic' & Allow HTTPS traffic'
Save > Then try to browse again.

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.

How to access jenkins dashboard on webbrowser in AWS?

I am very new to AWS and Devops part, I read some official documentation and I installed Jenkins server in my ec2-instance it's successfully installed and it's running also ,when i try to open by using http://my-public-ip:8080 it's not opening. How to open my Jenkins dashboard in my web browser?
This is my EC2 instance inbound rules:
When I am trying to search in my browser it's showing some thing like this:
This site can't be reached13.235.67.157 took too long to respond.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_TIMED_OUT
I would suggest go to your security group of this instance which is launch-wizard-5 Edit it and You have to choose "Custom TCP rule"
Then you will be able to add the port to 8080
Wait for second
and open http://my-public-ip:8080 in your favorite browser
You'll able to access your Jenkins GUI
Jenkins uses a specific port: 8080
To verify this, inside of your jenkins shell try this:
try with netstat -plnt.
and
curl localhost:8080 -v
If you have a valid response showing you that 8080 port is online, your jenkin is ready to use. Just configure the 8080 port in your AWS inbound rules. Finally you will be able to access with:
http://my-public-ip:8080
If you achieve that, your next goal must be to hide the 8080 port. For that you could use the ELB to assign a custom domain if you have someone.
Add security groups
ALLTraffic
0.0.0.0/0
Then refresh the page

Amazon 500150 : Unable to connect to Redshift Cluster

I followed all the steps mentioned on here
to connect to Redshift through Workbench J.
I am not using SSH to connect, so have left SSH settings alone.
When I select Security after selecting Redshift, I see :
Your account does not support the EC2-Classic Platform in this region. Cluster Security Groups are only available when the EC2-Classic Platform is supported. Instead, use VPC Security Groups to control access to your clusters. Go to the EC2 Console to view your VPC Security Groups. For more information, see Amazon Redshift Documentation on Supported Platforms and Managing Clusters in VPC.
My cluster is under a Security Group which has the following Inbound rule :
Type: Redshift
Protocol: TCP
Port Range: 5439
Source: Custom 0.0.0.0/0 (Experimental, just to test,
I will replace this with my IP address)
When I do a Netstat on the host from my machine with -Pn. I get a
Host is up.
PORT STATE SERVICE
5439/tcp filtered unknown
Nmap done: 1 IP address (1 host up) scanned in 2.22 seconds
I have already gone through several similar questions and none of these is working for me.
Double check your Security Group settings:
In the Redshift console, go to the Configuration tab.
Click on the link next to VPC security groups
Should take you to Security Groups in the EC2 console with the correct security group selected.
Select the Inbound tab for the security group and click the Edit button (a dialog box opens).
In the dialog box, click the Add Rule button then:
Select Redshift from the Type dropdown menu
Select Anywhere from the Source dropdown menu
Come back and change this to My Ip once your connection works!
Click the Save button (the dialog closes)
You now have 2 new Redshift rules (0.0.0.0/0 AND ::/0)
Then in SQL Workbench's "Select Connection Profile" dialog:
Click "Manage Drivers" at the bottom left and to add the Redshift JDBC driver.
SQL Workbench configures these automatically but check that Classname is like com.amazon.redshift.jdbc42.Driver and Sample URL is jdbc:redshift://host:port/name_of_database.
Next, configure the connection
Select the new Driver you just created from the drop down.
Copy the JDBC URL from the Redshift console Configuration tab and paste it into the URL field.
Must use the correct port: jdbc:redshift://my-cluster.asdfgh5jk8.us-east-1.redshift.amazonaws.com:5439/my-db
Add your Username and Password
Test the connection! (Bottom right)
Please let me know in the comments if this doesn't work for some reason and I'll help you get it working.

Access external IP google cloud windows instance

I have got the info as:
Each instance can also have an external IP address, which is routable over the Internet.
described here. But when I click the following arrow:
It shows The connection has timed out while I have enabled HTTP/ HTTPS access in console.
The firewall rules that have been applied are:
I have promoted external IP address to static but no success to get internet access for my Oracle Apex application.
Hope this help
The Windows Firewall with Advanced Security is a host-based firewall that runs on Windows Server 2012 and is turned on by default. Firewall
settings within Windows Server 2012 are managed from within the
Windows Firewall MMC (Microsoft Management Console). To review and set
Firewall settings perform the following:
Open the Server Manager from the task bar.
List item Click the Tools menu and select Windows Firewall with Advanced Security.
From the right side of either the Inbound Rules or Outbound Rules
**tab click **New Rule.
Select Custom from the Rule Type radial button and click Next.
Select the Program association for the Custom Firewall Rule as either All programs or the path to a program and click Next.
From the Protocol type field select the protocol type and click Next.
Select an IP address association for both local and remote addresses and click Next.
Select an action to take on matching traffic and click Next.
Select the profiles associated with the custom rule and click Next.
Provide a name for your Firewall rule and an optional description and click Finish.
Once created, the rule will be enabled. The firewall rule can be found on the corresponding Rule tab, either inbound or outbound
depending on the type created. To disable or delete the rule find the
rule in the MMC, right-click it, and select either Disable Rule or
Delete.