Can't get Amazon EC2 instance work - amazon-ec2

I am trying to setup an amazon ec2 instance for first time.
I've created one with ubuntu 10.4, managed to connect to ssh and installed mongodb, mysql, php and apache which need for my proyect(also python but it is already setup).
Then I associated an elastic ip to the instance, but when I try to open the IP, I can't. It gives timeout.
Could it be that the apache root is not where I think it is?(/var/www/)

You need to check the security group that is associated with the instance. Make sure that you open up port 80.
Also make sure that apache is started, and configured to start on boot.
If you're logged in, you should be able to use wget localhost to verify if apache is serving up pages.

Related

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

Configuring Amazon EC2 for a dynamic website

I am curious about Amazon webservices and so I thought of creating a dynamic webpage with Amazon EC2. I created an instance, installed apache and php and made sure it is working in EC2(using remote access). I have assigned a elastic IP to the instance. My question is how to access the webpage that I created in the instance. I am not sure what to give the servername in httpd.conf. My goal is access the page like http://amazonaddress/test.php
I am using windows server, but I think it is basically the same. My documents are in the same folder as mentioned in conf file. But when I use my elastic IP, it isn't working . Not even the basic index page in the apache htdocs(that's the home folder according to conf). To throw more light I will explain what I have done till now.
I have created a micro instance(EC2) and logged into it using remote desktop. I have installed apache msi file and php after that. I have created a elasticIP and attached the instance and to my security group I have added http service to port 80. I have tested if localhost is working in my remote machine(points to index.html). After that I have tried accessing it using elastic IP and it just times out. Is there any step I have missed?
You can access it via http://255.255.255.255 where you replace the 255.255.255.255 with your elastic IP address.
Then you want to setup DNS for your domain name. So you'll need to create an A Record mapping www.yourdomain.com to whatever your elastic IP address is. You can usually do this via your domain name registrar as most of them also run basic DNS services for free.
You can access an ec2 instance using it's public DNS name (or elastic IP since you already have one of those), which can be seen in the instances description tab. Configuring your personal domain name to point to that server will involve creating an A Record mapping to that public IP.
Assuming apache has been setup correctly, that's all you should need to do to get started (and your test.php page is in /var/www/). For your purposes, you probably shouldn't even need to modify the httpd.conf file at all.
Also, be sure to remember to open a port on the security group (under Network & Security from the EC2 Console) that the instance belongs to. In your example, you will want to open port 80 inbound with source 0.0.0.0/0 (unless you want to limit access to a specific IP range).
Hope this helps.

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. :)

Accessing Amazon ec-2 instance from the web

I have to do part of a college project on amazon instance. The lecturer set up the instances for the year, supplying us with the public DNS and KEY.
Having downloaded WINSCP to make it easier etc. I find that after i have created my html pages etc i cannot access them from the web.
IM assuming that that http://ec2----.compute-1.amazonaws.com/home.html should open the file ???
Any help would be apprciated
A few things.
httpd -v will tell you what version of http is installed. But it doesn't tell you whether or not its running. Use service httpd status to see if its running.
Check the apache config file and make sure you put the index.html file in the correct directory.
Verify that you can access port 80 from outside the instance. Its possible there is a firewall in amazon that the professor has not unlocked.
Download PuTTy and configure it to access your ec2 instance on terminal. Install any web server e.g Apache or you can install LAMP directly to make your file accessible on web.

Resources