How can I connect to my ubuntu server via http? - amazon-web-services

I have started using AWS t2.micro virtual machine. I installed apache2 and curl on it. If I type curl localhost on the ubuntu machine, it gives me the correct page. How do I now connect to the ubuntu machine with http from windows and fetch the same page?

Modify the security group of that instance(virtual machine) adding to inbound rules: port 80, Protocol tcp and source (IP to accept connection from) either the static IP address of the windows computer or 0.0.0.0/0 (any IP address).

I have fixed the issue by doing this in AWS:
Open EC 2 Dashboard
Open Instances
Click the instance I want to connect to
Scroll down to description and look at "Security Groups"
Look at the name of security group, mine was "launch-wizard 3"
On the sidebar, go to Network & Security > Security Groups
Find security group name (for me it was launch-wizard3), click on it and look down below where it says inbound, click on it.
Click edit
add rule
Type: HTTP, Source: anywhere
Save
Connect to your public ip and it should work.

Related

Remote desktop connection to ec2 instance

I have created a new free-tier windows 2019 EC2 instance in my default VPC, the new EC2 has a public IP, and the security group allows the traffic from anywhere and the RDP protocol is already configured to be ready on port 3389.
I have spent two days now with no luck connecting to this instance from windows remote desktop.
I have tried to ping the ec2 from my machine but no luck.
telnet from my machine to the ec2 working perfectly.
I have disabled the windows firewall.
remote desktop sometimes asks me to enter the password and sometimes doesn't ask at all.
**** when I changed my wifi network, I do the remote desktop connection and I can access the ec2 instance.
Any help in this.
I had the same issue as you have. In my case, The internet service provider blocked the SSH connection(PORT). though our security group allows to all we can't connect our instance.
Take this to them and get it fixed:).
I have a windows machine in EC2 which works, with the security groups set up as follows:
Inbound RDP, TCP port 3389 from 0.0.0.0/0
Inbound All ICMP v4 from 0.0.0.0/0 <- This is necessary to ping the machine
Outbound All traffic, All protocols, all ports to 0.0.0.0/0
Outbound ALL traffic, All protocols, all ports to ::/0
A few more hints:
If you restarted the machine and haven't attached an elastic IP, the public IP address will have changed
You can try telnetting to the RDP port 3389
Run the reachability analyzer tool in the VPC management console
You can try connecting via a different computer or a different connection, e.g. a personal hotspot to rule out firewall issues on your side
Update:
RDP is a quite ressource-intensive protocol compared to e.g. ssh or telnet. You haven't specified if you are trying this from a home or corporate network. Could the quality of your internet connection be a problem? Comparing to e.g. a public or private hotspot might help.
Last but not least, you say it worked when you "changed your wifi network" - I'm not quite sure what to make of that statement. Did you change the configuration? Did you change TO your wifi from a wired network?
If you are in a high-density area, Wifi networks can strangle each other. If you always were wireless, try wired. If your wireless works better than your wired, check the cables for kinks and tears.
Colleagues of mine once spent an hour trying to find out why a mainboard would always go into flash mode, until I suggested unplugging the keyboard - it was a stuck F10 key. Bottom line: try to think of the factors you've so far overlooked.
You probably need to setup your inbound rules on the security group.
Go to Instances and find the value for the column: Security Group Name
Then under Network and Security go to Security groups.
Click on the Security group ID that has the matching Security Group Name you looked up.
In the inbound rules you need to make sure you add yours and modify it until it looks like this:
Type: RDP Protocol:
TCP Port: 3389
Source: 0.0.0.0/0
Description: open to the world to test only
Better would be to use a source that you know you are coming from, but you'll need to change it if your IP changes.
https://www.whatismyip.com/
if your IP is 17.18.19.20,
then enter 17.18.19.20/32

AWS EC2 Windows Server 2016 expose port 80

What I'm trying to do is access my webserver on my EC2 from the outside.
Here's what I've done so far:
I've opened all Incoming Traffic to anywhere both for IPv4 and IPv6 in the EC2's Security group
Disabled the firewall from the Control Panel in the EC2 for both public and private
Started my webserver on port 80
From outside the ec2:
I can ping the EC2 succesfully
If I run telnet <my ec2 ip> 80 I get telnet: Unable to connect to remote host: Connection refused
If I run nmap <my ec2 ip> port 80 is not listed
From inside the ec2:
I was able to connect from localhost:80 in EC2's browser
If I ran netstat -aon it shows it is listening on port 80
Make sure that your web server is bound to the external network interface.
Using 0.0.0.0 will ensure that connections can be made from any interface. On the other hand, using 127.0.0.1 (localhost) would have behavior like what you describe, where you can connect to the web server locally, you can reach the host externally (e.g. via ping) but cannot connect to the web server externally.
Is your EC2 instance in a custom VPC? If so, look at attaching an Internet Gateway to the VPC and update the route tables associated with the subnet in which your instance is running.
For this answer I am assuming that you are using IIS as your web server.
1) Start Internet Information Services (IIS) Manager.
2) Expand the left hand panel "Connections" and locate your web server under "Sites".
3) Select your web site. In the right hand panel click on "Bindings".
4) A "Site Bindings" dialog box will open.
5) Under the tab "IP Address" make sure that an asterisk displays so that the server binds to all network interfaces on startup.
5) In the right hand panel under "Manage Website" click "Restart".

AWS Public DNS does not load even though SSH works

I have set up an AWS EC2 Instance with LAMP stack and installed Wordpress.
My instance was accessible through a browser via its public DNS. I logged into wordpress admin and made some changes and everything was working ok.
I then added an Elastic IP and I now cannot access my site through a browser via its public DNS.
However, the server is fully accessible via SSH.
The public DNS is:
[ec2-52-210-2-56.eu-west-1.compute.amazonaws.com][1]
My security groups are as follows:
80 tcp 0.0.0.0/0
22 tcp 209.93.74.222/32
443 tcp 0.0.0.0/0
I have removed the EIP. That made no difference. I have rebooted and stopped and restarted the instance. That made no difference either.
I am not sure how to fix it?
I had similar problem when i was new to AWS figuring out new things.
What i found out was you need to perform the below steps to redirect your url to correct IP address:
The old site URL and the new site URL for your instance. The old site URL is likely the public DNS name for your EC2 instance when you installed WordPress. The new site URL is the current public DNS name for your EC2 instance. If you are not sure of your old site URL, you can use curl to find it with the following command.
$curl localhost | grep wp-content
You should see references to your old public DNS name in the output, which will look like this (old site URL in red):
<script type='text/javascript' src='http://ec2-52-8-139-223.us-west-1.compute.amazonaws.com/wp-content/themes/twentyfifteen/js/functions.js?ver=20150330'></script>
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Search and replace the old site URL in your WordPress installation with the following command. Substitute the old and new site URLs for your EC2 instance and the path to your WordPress installation (usually /var/www/html or /var/www/html/blog).
$ php wp-cli.phar search-replace 'old_site_url' 'new_site_url' --path=/path/to/wordpress/installation --skip-columns=guid
Your website will be fixed!!!
Done!
NOTE: But everytime you change the IP you need to change your url to new IP.
Visit This site can’t be reached Amazon Ec2
I got the issue with Windows EC2 while connecting through HTTP 80 port and followed below link.
If your computer is on a corporate network, ask your network administrator whether the internal firewall allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).
If you have a firewall on your computer, verify that it allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).
or follow link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html#TroubleshootingInstancesConnectionTimeout
Check Firewall settings in your Windows EC2: Goto > Firewall Settings or Properties choose public profile > check inbound connections, change to "Allow" if it is "Blocked by default"

AWS t2.micro EC2 instance running JetBrains YouTrack on port 80. Cannot access YouTrack on public IP

I have installed IntelliJ YouTrack running on port 80 on a Windows Server 2012 t2.micro EC2 instance on AWS.
I am able to access YouTrack when I remote desktop into the machine and enter http://localhost or http:// or http://. Therefore I know the application is up and running on the expected port.
I have whitelisted my ip by adding the relevant inbound rule under the security group settings for the instance.
I was assuming that was the only necessary step to allow inbound connections to that specific port. However I cannot access YouTrack when I enter the public IP of the instance on my web-browser from the whitelisted IP. Also what I find more confusing is when I try to enter http:// within the remote desktop of the instance, I am still unable to connect.
What am I missing for enabling incoming connections to a port on my EC2 t2.micro instance?
I appreciate all the advice.
It seems that Windows firewall was running and blocking the connections beyond the security group settings. Opening port 80 within Windows firewall fixed the issue.
When I first ran into the issue I typed "Firewall" into the start search. First result was "Windows Firewall with Advanced Security". When I opened that I got the error "There was an error opening Windows Firewall with Advanced Security snap-in". I immediately assumed AWS eliminated the firewall service from the windows builds to force customers to prefer the security group controls of the AWS console.
Embarassingly I have just now tried the second option in the list "Windows Firewall" which showed the normal windows firewall being active and of course blocking incoming connections to port 80. I have added the exceptions to the required ports and the issue was immediately resolved.
I hope this helps someone else out there.

How to view website launched in Amazon EC2 instance?

I have followed the steps provided by Amazon EC2. I have installed a wordpress website in the EC2 Instance.
My public DNS is given as ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com/
and Public IP is also given as xx-xxx-xx-xxx.
How to view the website from any other machine?
Note:
EC2 Instance is created and running now.
I can view it in the localhost as well as public DNS in the EC2 instance using RDP. (http://ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com/)
If you can see the web site from the EC2 instance, but not from other machines, there is probably one of the following things wrong:
The DNS entry is not available or is wrong. Since you can RDP using that entry, this can't be the cause.
Access to the correct port is being blocked by the security group or firewall. Since the instructions you referenced specifically say to make sure that both port 80 (HTTP) and 3389 (RDP) are open, and you know that is true from port 3389, this isn't likely, but is possible. Make sure that there are security group rules for both port numbers that look the same.
The Windows server itself is refusing to allow outside access to port 80 on that address. This is unlikely, but not impossible, and the instructions specify that you should "disable Internet Explorer Enhanced Security Configuration", and at the end cover "Making Your WordPress Site Public". Make sure that the web server isn't configured to only respond to requests from localhost (127.0.0.1) and that there are no Windows firewall rules blocking port 80.
I think that the likeliest problem is number 2, above. Perhaps you forgot to open port 80 in the security group, or typed a different port number or a different address range to open it to.