Getting a cherrypy Hello World running on EC2 instance - amazon-ec2

I am trying to do a simple proof of concept on a new EC2 instance in which I run the "Hello World" tutorial code from the CherryPy distribution.
CherryPy launches successfully, and a wget run directly on the EC2 instance successfully retrieves the Hello World page. However, trying to access the same page from my own machine results in a "could not connect" error.
CherryPy is running on port 8080, and my EC2 instance is set up with a security group that ought to be allowing traffic from anywhere to connect to port 8080.
Here is my CherryPy tutorial.conf:
[global]
server.socket_host = "127.0.0.1"
server.socket_port = 8080
server.thread_pool = 10
I have tried connecting to the web server using both the public DNS listed in the AWS management console, as well as by setting up an elastic IP; neither allows a successful connection.
Any guidance would be greatly appreciated.

Set the socket_host to the server ip or '0.0.0.0' for external access.

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

Accessing webserver on AWS ec2 (Ubuntu)

I am running a webserver on an Ubuntu ec2 instance. The service accepts http connections over port 8080.
The next step is to allow the service to be e accessible using public_DNS:8080. I've modified the security group to accept all incoming traffic on 8080. However, I get connection refused when I try it on my browser. I am guessing it is something to do with the Ubuntu firewall.
I have very little idea about it. Any suggestions on how I can proceed to resolve this?

How do I access 127:.0.0.1:5000 on Ubuntu Server 16.04 LTS (HVM), SSD Volume Type

I just started studying flask and built a toy website to see how well I am doing. I have a flask website built in python 3.6 and I have tested it on my windows computer and everything goes very well. Now I want to host the website on an ubuntu ec2 instance. But first, I am testing if everything runs well on my ec2 instance and am stuck at trying to access port 5000 on my ec2 instance My app is currently serving on port 127.0.0.1:5000 of my linux server. I have tried to connect to my.ec2.public.ip:5000 and my.ec2.private.ip:5000 with no success. Could someone help me? Thanks.
By default, your Flask app will listen only on localhost, you need to add host arg in run in make it listen to your actual server's IP.
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80) #or whatever port you want your app to listen to.
To edit the security group of your instance, go to the EC2 instances page and slide to your extreme right, you will have Security Group column. Here click on the security group written in your instance and edit to add the port that you want to open.
By default a new AWS instance would not allow port 5000 to be accessed, so you will need to modify the security group to allow access on that port. You do this thru the AWS console.

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

Set up an EC2 Server to run as Proxy usable through Ruby

I need to access a site from behind a proxy server. I can do it from within a EC2 instance, but it would be really nice if I could use my own EC2 server and when using nokogiri or mechanize to be able to set the instance as my proxy. I have tried enabling HTTP requests and SSH requesting from any source. When I try to connect to the server through ruby running this code.
open('http://example.com/', :proxy => 'http://ec2-54-242-232-173.compute-1.amazonaws.com:80')
I get back either... A connection error(2)
Or an error saying that the end of the file has been reached.
I have tried basic authentification with valid credentials as well.
Can someone try and walk me through the process of setting up an ec2 server and using it as a proxy server through mechanize?
For your case you need to do a few things:
Make sure your EC2 instance is running some sort of proxy server (Squid is good)
Make sure your instance and Squid (or whatever) are set to accept external connections
Configure your Ruby script appropriately
To setup the EC2 instance, use this guide: http://hackingonstuff.net/post/23929749838/setting-up-a-squid-proxy-on-aws
To setup the script just make sure it uses the instance's public DNS name and the port your proxy service is listening on. The public DNS name/ip changes each time you launch the instance so just be sure not to over look that small but important detail. :)

Resources