Branka
Branka

Reputation: 479

Enable Access Google Compute Engine Instance Via HTTP Port

I have created a Google Compute Engine instance and installed a web server and my app. Now I am having trouble finding information on setting up an external address so that I can access the instance from outside Compute Engine.

How can I setup an external address for my instance so that it is accessible through clients, such as web browsers?

Upvotes: 6

Views: 5948

Answers (2)

micksatana
micksatana

Reputation: 193

You can access by using External Address located in the menu Compute Engine->VM Instances.

The address can be eighter Static or Ephemeral. Only different is when you delete VM Ephemeral IP wil be released but Static IP you can reassign somewhere else.

Now, things to check are..

  1. Under the Compute Engine>Networks menu, click "default" network and Create new Firewall Rule. Set the Protocols & ports to "tcp:80" (without double quotes)
  2. Make sure your VM is properly configured iptables and semanage.
  3. iptables. You can follow this instruction https://www.digitalocean.com/community/articles/how-to-setup-a-basic-ip-tables-configuration-on-centos-6
  4. semanage is required if you're on RHEL and you want to customize directory configuration. You can follow this instruction https://lists.fedoraproject.org/pipermail/selinux/2011-March/013586.html

I faced this problem before. My case was iptables. The easiest way to check if it's a iptables blocking, you can simply turn it off first by this command.

service iptables stop

And try access from web browser if it works. In case it is, then you may want to check iptables configuration1

Upvotes: 2

Colin Su
Colin Su

Reputation: 4619

Because you've created and setup your machine, so the only way to give it a static ip address is:

  1. Go to Cloud Console
  2. "Compute Engine" -> "Networks"
  3. New Static IP
  4. Attach it to your GCE instance

and one more thing need to be noticed, you will have to check and configure your firewall to make your GCE instance be accessible externally.

By default, GCE opens only SSH port to outside, and all ports for internal.

If you have any purpose to open any port, I suggest you to create a new firewall to deal with this sort of operation.

Upvotes: 4

Related Questions