10

I have Amazon EC2 micro instance with window 2008 server and deployed one sample web application over there which uses java and deployed on tomcat 7 server. I am able to access it locally on instance, but when I tried to access it outside of AWS instance lets say from my home computer using AWS public DNS / public IP address/ Elastic IP address of the instance, it gives me "Web page is not available".

I have gone through so many similar questions in this forum and i think i have done all the setting they are asking to do, but still no success.

Here is what I have done/confirmed.

1. localhost works, so application listens on port 80.

2. added inbound rule for HTTP on port 80 for everyone under the security group that my instance is using.

3. checked firewall setting on windows instance, made sure port 80 is not blocked.

4. tried even with turn off firewall, but no success.

I would really appreciate if some one can help me on this.

Thanks, NS

  • 1
    What does telnet tells you and traceroute? – Pratap Sep 17 '14 at 7:14

10 Answers 10

5

I had a similar frustrating problem when I installed JetBrains YouTrack on a Windows Server 2012 ec2 instance. What worked for me was opening the Windows firewall ports that java was using specifically and disabling the World Wide Publishing service port. I also had to run the YouTrack service under the LocalSystem account instead of the default account.

Try this:

  • Turn off the default website in IIS if it is in use

  • Run a netstat -a -b to discover the ports the java.exe was attempting to bind to e.g:

    TCP 0.0.0.0:80 WIN-9NFIG6IEPT6:0 LISTENING [java.exe]

    TCP 127.0.0.1:49306 WIN-9NFIG6IEPT6:49307 ESTABLISHED [java.exe]

  • Open the service control manager and right click on your service and open the properties dialog. On the Log On As tab select Local System Account as the account the service runs under. It's important that this user be Administrator

  • I highly recommend turning the firewall back on.
  • Open the firewall Inbound rules tab and disable the World Wide Web Services (HTTP-In) Rule
  • Create a new rule for Tomcat with TCP Port 80 and any other port it might need.

  • Save the rule and test your url from outside the server.

| improve this answer | |
4

You shouldnt be turning off firewall setting completely. This would compromise the security of your app. Instead modify the windows server inbound firewall rules to allow incoming traffic on specific ports.

I had a similar issue where I had deployed an app on Tomcat 8 on windows 2012 server provisioned through AWS EC2. I could access the deployed app on http://localhost:8080 from within the VM but not from the public internet after replacing the string localhost in the URL with public IP address of the VM.

It worked fine after I changed the firewall rules to allow incoming traffic on port 80 (for http), port 443 (for https) and port 8080 (this is the port at which my web app was deployed to by default on the tomcat server.

I have documented the firewall and security group configs at the link below:

http://abhirampal.com/2015/08/04/firewall-config-for-java-web-app-hosted-on-aws-ec2-windows-2012-server/

| improve this answer | |
  • 1
    Awesome, You saved my day <3 – Thamaraiselvam Apr 10 '18 at 7:48
1

You probably missconfigured the webserver. You can test that by connecting to the server via:

telnet $IP 80

if you are not getting an error, you can connect. In this case you did not set the webserver up correctly.

| improve this answer | |
  • You are right, I am not able to connect via telnet from my local computer to aws instance. Can you please help me how can I fix it? I tried looking up IIS on aws instance and it is running. – user242725 Sep 18 '14 at 6:42
  • Thanks. It worked after turning off domain,private and public firewall on instance. But not sure, how can I secure the instance and at the same time access my webapp outside of instance. – user242725 Sep 18 '14 at 7:30
1

A rule for Inbound TCP port 80 may need to be entered in the AWS Security Group for your instance.

| improve this answer | |
1

You might need to make port available to listen to any public call from the AWS console.

| improve this answer | |
  • The AWS console has lots of features, perhaps you could be more specific. – kmarsh Oct 30 '15 at 15:15
1

Please follow this link http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/using-network-security.html, Section Security Groups

Create a Security group for your EC2 instance to allow connections on the ports you desire.

| improve this answer | |
1

Two things for me:

  1. Modification of the Security group attached to my RDS instance to allow traffic in and out

  2. Setting inbound and outbound rules in the RDS for the application port

Detailed steps:

  • On the top bar of you AWS console, click Services, select EC2

  • On the left menu of the next window, under instances, click instances to view you instances

  • In the table that contains the instance you want to access from the public, scroll to the right to a column named Security Groups. Click on this security group.

  • In the table that displays, scroll to the bottom of it that has description of the security group and other tabs like Inbound, Outbound, Tags
  • Click on the inbound tab. Click edit. By default there is one rule (RDP).
  • Lets add two more
  • Click Add Rule button.
  • Select All Traffic for Type, All for Protocol
  • Leave the port range (0 - 65535), select source as Custom.
  • All these apply for both rules 2) For the first rule, in the text box that appears after source, put 0.0.0.0/0 3) For the second rule, put ::/0 4)
  • Hit Save

    Now login to your AWS RDS to set inbound and outbound rules through the fire wall

  • Launch the control panel. Click on System and Security (may be the first), and click on Windows Fire wall. Then click on Advanced Settings

  • Click on Inbound Rules menu on the left.

  • In the Actions tab (on the right), click New Rule

  • Select Port and click next

  • Select TCP (if not selected), and below Select Specific local ports.

  • In the field put in the port number of your application and click next

  • Select Allow the connection and click next.

  • Specify the rule name. Something like the name of your app for readability purposes and click finish

Then lets configure out going traffic

  • On the same menu as for Inbound Rules, Select Outbound rules and follow the same procedure as described for inbound rules
  • After these settings, you must be able to access your application from outside
| improve this answer | |
0

Please refer the link..It would be more specific.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html

You can allow communication between all instances associated with this security group, or between instances associated with another security group and instances associated with this security group. Click Add Rule, select All ICMP, then start typing the ID of the security group in Source; this provides you with a list of security groups. Select the security group from the list. Repeat the steps for the TCP and UDP protocols. Click Save when you are done.

| improve this answer | |
0

Its mostly the issue with the Windows Firewall. I tried the same steps as you did it was not successful. The moment i turned of the firewall it was fine. I think the security should not be affected as we are configuring inbound outbound rules.

| improve this answer | |
-1

For WINDOWS Instance - Right click EC-2 Instance name, browse to the .pem file created during Instance creation and click Decrypt password. You will get the username and password to connect via Start-->Run-->mstsc-->Windows IP with Windows Authentication as Administrator and its password

For LINUX Instance --> Download puttygen and click on LOAD button to select the .pem file and then click on GENERATE button to generate an ppk file. Via putty, enter the IP and under Connections -->SSH-->AUTH-->Browse to select the .ppk file and save the putty sessions.

| improve this answer | |
  • This would be a great answer if the question had been "how do I log in with my SSH key". But the question was "how do I access a web page from my browser". – Jenny D Dec 19 '17 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.