Today, I tried to make a blog with Google Cloud Platform.
So, I made a Computer Engine Instance and install Apache2 on Ubuntu 16.
And then, clicked the Outer IP address, but it show me "connection denied.."
Why this happen?
I allowed HTTPS % HTTP Traffic also.
And I can't find a menu like AWS's Security Group...
So, this problem irritate me...
(I'm not a English native, so documentation is so hard read.. please, give me a tip for this matter)
TL;DR - You need to open up ports using firewall rules to allow ingress traffic into your VMs.
Google Compute Engine (GCE) blocks all traffic to your VMs by default for the purpose of keeping your infrastructure secure. You can open up ports as needed and manage the security yourself. The default created network has few exceptions in terms of allowing traffic from other VMs in the network, but still does not allow traffic from outside the network.
Since you say
apache2
package on Ubuntu, the instructions I share here will guide you on how to open up port80
on your VM and make it accessible through the VM's public IP. You can do the same for any additional ports as needed.Using gcloud to allow ingress traffic for
tcp:80
into your VMUsing Cloud Console to allow ingress traffic for
tcp:80
into your VMMenu -> Networking -> Firewall Rules
Create Firewall Rule
Choose the following settings for the firewall rule:
Name
for the rule -rule-allow-tcp-80
or any other name you prefer for this firewall rule.Direction
isingress
Action on match
isAllow
Targets
isSpecified target tags
Target tags
isallow-tcp-80
Source IP ranges
is0.0.0.0/0
(or if you have a set of IP ranges you know will be the only ones accessing this, use them instead for stronger restriction)Protocols and ports
istcp:80
Create
button to create this firewall rule.Once you've created the above firewall rule you will need to add the tag
allow-tcp-80
to all the instances where this rule needs to be applied. In your case:VM Instances
pageVM instance details
page, select theEdit
link on the very top.Network Tags
box, enterallow-tcp-80
to apply the tag to this instance.Save
to save the changes.Now give it a few seconds to a few minutes for the changes to take effect and you will be able to access the jenkins web URL.
You can also go through the documentation for Firewall rules to get a better understanding of how they work and how to configure them.
WARNING: By using a source range of
0.0.0.0/0
, you're opening up the port on the VM to the entire internet. This lets clients anywhere in the world to connect to the application running on this port. Be fully aware of the security implications of doing this.