How to configure direct http access to EC2 instance?

后端 未结 6 2048
面向向阳花
面向向阳花 2020-12-25 13:12

This is a very basic Amazon EC2 question, but I\'m stumped so here goes.

I want to launch an Amazon EC2 instance and allow access to HTTP on ports 80 and 8888 from a

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-25 14:05

    (0) It's silly but the first thing you need to do is to make sure that your web server is running.

    (1) You need to edit your Security Group to let incoming HTTP packets access your website. If your website is listening on port 80, you need to edit the Security Group to open access to port 80 as mentioned above. If your website is listening on some other port, then you need to edit the Security Group to access that other port.

    (2) If you are running a Linux instance, the iptables firewall may be running by default. You can check that this firewall is active by running

    sudo service iptables status

    on the command line. If you get output, then the iptables firewall is running. If you get a message "Firewall not running", that's pretty self-explanatory. In general, the iptables firewall is running by default.

    You have two options: knock out the firewall or edit the firewall's configuration to let HTTP traffic through. I opted to knock out the firewall as the simpler option (for me).

    sudo service iptables stop

    There is no real security risk in shutting down iptables because iptables, if active, merely duplicates the functionality of Amazon's firewall, which is using the Security Group to generate its configuration file. We are assuming here that Amazon AWS doesn't misconfigure its firewalls - a very safe assumption.

    (3) Now, you can access the URL from your browser.

    (4) The Microsoft Windows Servers also run their personal firewalls by default and you'll need to fix the Windows Server's personal firewall, too.

    Correction: by AWS default, AWS does not fire up server firewalls such iptables (Centos) or UAF (Ubuntu) when you are ordering the creation of new EC2 instances - That's why EC2 instances that are in the same VPC can ssh into each other and you can "see" the web server that you fired up from another EC2 instance in the same VPC.

    Just make sure that your RESTful API is listening on all interfaces i.e. 0.0.0.0:portID

提交回复
热议问题