What is the endpoint of the EC2 linux1 instance? - amazon-web-services

I created an EC2 linux1 instance and I SSH into it. I installed NodeJS and cloned a git repository to the instance. The app is successfully running and connected to the MySQL database instance I created from the RDS. Assume the app name is my-app. What I want is to be able to access the the app on the server.
I tried
- ec2-{Public DNS (IPv4)}.compute-1.amazonaws.com/my-app/{endpoint} (not working)
- {Public DNS (IPv4)}/my-app/{endpoint} (not working) (not working)
The security group of the instance is set like below:
Any help is appreciated

If your app is running on port 4000, you need to either open that port in your security group, or add a firewall/reverse proxy to forward from 80/443 to 4000.
You can use iptables to forward the port:
Forwarding traffic from 80 to 8080
or apache as a reverse proxy:
Apache redirect to another port

Related

Deploying a Go app in AWS ec2 got connection refused

I have a compiled Go project that I want to deploy to an AWS EC2 instance. I just simply upload the application and run ./application on the remote server.
In the terminal, the application is running and says he's listening to localhost:3000.
I've already added the 3000 port to the security group.
However, when I tried to access it in my browser using <public-ip>:3000, it always shows connection refused, whether I've run the application or not.
I tried to run the app locally, it does work.
So is it because I deploy it incorrectly?
It is a bit difficult to help you because of no code being shared.
Some reasons why you got connection refused:
Your application is listening only localhost:3000
EC2 security group does not expose port 3000
How to fix:
Most applications are defining the host address on a config file or env variables. If you have access to change it, change it from localhost:3000 to 0.0.0.0:3000 to accepts connection from all IP or to your_ec2_public_ip:3000
If host address is hardcoded and you have access to code, change the code per above
If you don't have access to config or code to change the host address, then add a reverse proxy to route the incoming call to localhost:3000. This is a good link about using Nginx as reverse proxy https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
Ensure EC2 Security Group allowing inbound connection for the designated port, in this case, is 3000 if you manage to route the incoming to your_ip:3000

How to access a website that is deployed in a Windows instance in EC2?

I have created a Windows instance in EC2, also installed the Bitnami WAMP stack there. The web app runs on the instance, however it does not display on a browser outside the instance with the public IP of the instance.
I have configured the Security Groups this way:
Port 80 (HTTP inbound and outbound)
Port 443 (HTTPS inbound and outbound).
What else need to be done, in order to display the web app on a browser? Thanks
The issue was solved by disable the Firewalls on the Windows O.S directly (instance).

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"

My AWS ec2 instance is running on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com:8000. how do i make it run on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com

My AWS ec2 instance is running on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com:8000. how do i make it run on ec2-xx-1xx-xxx-24.compute-1.amazonaws.com
I am using Gunicorn server server and it is a Django application on Ubuntu server
You can configure the same via virtual host in httdp.conf with redirection rule or you can do the same with ELB in which you can mention the request comes on 80 and ELB will forward the same on 8000 port.
This is a two step problem:
You have to configure Django to listen on the right port, and you also have to modify the security group attached to your instance to allow connection on port 80.
You can either allow access from anywhere or from a specific IP/Range of IPs.
An other solution is to create an ELB and configure it to listen on port 80 and send the traffic on port 8080.

What Do I Need To Do To Enable My EC2 Windows Instance As a Web Server?

I'm not a hardware guys, so I'm probably missing something simple, but I did the following:
Created a Windows VM.
Activated the web server role/IIS features (I can successfully serve a page via localhost when remote desktopped in).
Made sure outgoing port 80 wasn't blocked in Windows firewall.
Created a load balancer that pointed to the instance (to make enablement of SSL easier).
I then tried pulling up both the load balancer public DNS and the VM'w and neither of them pull up any web page. The Windows VM instance reports that it's running, but the load balancer reports that the VM is OutOfService trying to forward port 80.
What do I need to do to be able to serve my web site?
Open port 80 on the AWS security group assigned to your EC2 instance.
Open inbound access to port RDP in your security group.
This will make you to access the Windows server of your ec2-instance.
Edit the Security Group assigned to your EC2 instance and add a rule to allow port 80 in Inbound and outbount rules.