How to run application on port 3000 on Public and Not Private IP Address in AWS EC2 Instance (so it can be accessed on the internet) - amazon-ec2

My problem is that I want to run an application on an AWS EC2 instance on port 3000. I then want to be able to access it from the internet using http:/PUBLIC_IP:3000. The problem is that when I am running the application on the EC2 instance, it runs on the private IP - and therefore I cant access it from the internet. How would I make sure that the app will run on the public ip, or how would I set it up, so I can access the application over the internet?
I tried to find a solution online, but some hours later I find myself in here.

Thank you for your help. It was very helpful in debugging the error. It turned out that the security group of the EC2 instance was not allowing traffic on port 3000 so I had to add that - and then it worked.
I furthermore had trouble putting it behind a Load Balancer. The solution to that was that it was a webpack application and in .webpack there is a configuration file where you can add e.g., allowedHosts: [.amazonaws.com].

Related

Reachability Analyzer shows not reachable from my IGW to Ec2 instance which is why i think might be getting (failed)net::ERR_CONNECTION_REFUSED error

I am just testing out Apis in my local and they all seem to work pretty good with localhost:8080. So i just uploaded the whole application to ec2 instance.
I uploaded my Local Springboot Application to the Ec2 instance, got the vpc, public & private subnets, got proper route tables, and when i try java -jar demoApplication-SNAPSHOT.jar from my SSH terminal, it seems to be running on port 8081 in the server. But when i try to click on the public ipv4 DNS address on ec2 instance, it says the site is not reachable.
I have allowed the chrome browser through firewall too but even that isn't working. Any help on this will be gladly appreciated!
below is the snippet from postman for the reference.
enter image description here

How to use run deck service from local browser using up address?

I have installed rundeck in docker using ec2 instance.
When I run the image and start rundeck. It's fine.
Lynx http:localhost:4440
Us able to show rundeck dashboard.
But, how can I access this rundeck from Windows browser?
I tried using address but connection refused.
In order to access this from outside for your setup, you might have to ensure the following things:
Ensure that host server (ec2) is forwarding ports to the docker container. You should have used -p or -ports when launching the container for this.
Test: From your EC2 instance, you should be able to access: http://localhost:4440
Ensure you have a public IP assigned to your EC2. You should be able to see that from your aws ec2 console: http://console.aws.amazon.com/ec2
Ensure that your security group(s) for that instance has InBound connections to accept 4440 from your IP or rest of the world.
After this, your http://:4440 should work.
I hope I got your question correct.
Let me know how it goes,
Thanks,
Anoop

I suddenly cannot connect to my EC2 instance. Why? How can I mitigate this?

I had a running instance, and then I became unable to connect to it via http(80) and ssh(22). I tried to reboot the instance, but nothing went up. This has happened to me twice in the past month.
Why does it happen? Can I do anything to fix and/or prevent it from happening?
If I launch a new instance in same region, and it works.
Things to check when trying to connect to an Amazon EC2 instance:
Security Group: Make sure the security group allows inbound access on the desired ports (eg 80, 22) for the appropriate IP address range (eg 0.0.0.0/0). This solves the majority of problems.
Public IP Address: Check that you're using the correct Public IP address for the instance. If the instance is stopped and started, it might receive a new Public IP address (depending on how it has been configured).
VPC Configuration: Accessing an EC2 instance that is launched inside a Virtual Private Cloud (VPC) requires:
An Internet Gateway
A routing table connecting the subnet to the Internet Gateway
NACLs (Network ACLS) that permit through-traffic
If you are able to launch and connect to another instance in the same subnet, then the VPC configuration would appear to be correct.
The other thing to check would be the actual configuration of the operating system on the instance itself. Some software may be affecting the configuration so that the web server / ssh daemon is not working correctly. Of course, that is hard to determine without connecting to the instance.
If you are launching from a standard Amazon Linux AMI, ssh would work correctly anytime. The web server (port 80) would require installation and configuration of software on the instance, which is your responsibility to maintain.

I cannot acess to the website host on Amazon EC2 instance even I think the configuration is right

I have a free Amazon EC2 instance. And I installed Apache web server on it. I have the DNS record for my domain point to the ip for the EC2 instance. I can not access to my website. Then I looked up and allow the http inbound. But I still failed to access my web? What might be the reason. Anybody gives me a clue?
Go to the AWS management console and look at the Security Group the instance is in. Then make sure you have the port open that you are trying to connect to (most likely 80). To open it to the world set the ip range to 0.0.0.0/0 and to open it to a specific ip (like only your house) set it to xxx.xxx.xxx.xxx/32.
That is almost always the reason people have problems connecting when they are new to AWS. I wrote this post, which should help get you setup.

How do I connect up my Amazon EC2 instances without manually modifying config files?

I have a three-tier Windows-based web application bundled into 3 AMIs on Amazon EC2 that I use for load testing.
An ASP.NET web application on IIS
An .NET application server
SQL Server
After I launch them, the config files of each tier needs modifying to update the IP addresses.
At the moment I am doing this manually: I connect to the webserver instance via remote desktop and modify the config file to point to the new IP of the application server instance. Then I do the same with the application server to change the IP in the connection string.
This must be a common requirement and I must be missing something obvious. There must be a better way!
I could use Elastic IP addresses, but these machines are only provisioned for a couple of hours at a time, and I would be charged for the addresses when they were NOT in use (which would be most of the time).
Is there some way of persistently naming the machines? Can I somehow get all the machines on the same network and use machine names instead of IP addresses?
I could write some nifty PowerShell script that would perform the modifications remotely. Is there an example somewhere?
I could use a dynamic IP address service. I'm not sure if this would have any negative effect on performance or availability... Are there any downsides to this approach?
I could install some sort of self-configuring service on each machine (which connects to S3? SNS? SimpleDB?) to publish/retrieve the addresses of the other machines and update the config files automatically. Is there an example somewhere?
What is best practice?
You could use Amazon Virtual Private Cloud (Amazon VPC). You have a private subnet where you can assign an IP address to an instance, but it may require launching an instance from command line to assign IP. VPC is charged the same way as EC2.

Resources