how to use ftp on amazon aws - ftp

Today is my second day of trying to use amazon and i have started to pull my hairs. I want to set up ftp with amazon. I have signed up with them and and created an instance with amazon EC2. I have downloaded the key and I am able to login with ssh using the through Terminal in my mac. I can create files in the instance through terminal.
The instance is something like following:
Public DNS: ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com
I have created a index.html file at this location via terminal. But I am not able to view it in the browser using following url:
ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com/index.html
I just want to create web services here which I will be using in iPhone.
Also I am not sure how to go forward. How will I get to my local files and upload them to server. In other ftps I could do it using lcd, get, put etc but these commands are not working here. can some one please help me how should I go ahead because at this moment I am just banging my head to wall. Someone please help me.
Thanks
Pankaj

Use scp to copy files over ssh:
scp -i key-pair-file file-to-upload ec2-user#instance-public-DNS:
Notice the colon at the end!
With plain EC2 instances, you also need to install some sort of Web server software to power your Web service, and open the HTTP port in the firewall.
Just in case you plan to write your Web service in Java, I have put together a series of articles (Part I, Part II, Part III) guiding through the basics of installing Apache Tomcat on an Amazon Linux EC2 instance.

EDIT 2014/11/20
Dmitry Leskov is actually the better one. You should use his approach.
Answer from 2012
You first have to setup a LAMP (Linux, Apache, mySQL, PHP) stack on your EC2 instance to run any kind of web service.
This means you have to go trough the following steps:
Create an EC2 instance
Setup EBS Storage for mySQL data
Install mySQL
Configure mySQL
Install Apache
Configure Apache
Install PHP
Configure PHP
If you need a detailed instruction, I'd recommend you to take a look at this: Building EC2 with LAMP.
To transfer files to your EC2 instance you can use any FTP client, which supports SFTP and key pairs (you can also enable PasswordAuthentication for SSH to login with credentials). I'm using Transmit with no problems.

On a related note, I encountered a strange problem where I could not FTP from a PHP script running under apache - but I could if I ran the PHP script as root from the command line. After a day of googling, I found this, which solved the problem.
Disable SELinux. (Security Enhanced Linux)
The temporary solution is:
echo 0 >/selinux/enforce
..which will prove the concept, but will not survive a reboot. There are plenty of resources out there that describe how to permanently disable SELinux.

Related

How to deploy a laravel application that will be accessed over a LAN on a windows server?

I am tasked to develop a laravel project for our company. I have to deploy it within the company's network only. It is my first time to do it and haven't find any good source of instruction so far. I hope you can help me with this. I am using XAMPP for this one. And the machine runs on a Windows Server 2016.
Laravel applications are easy to install on IIS. You can use the url_rewrite extension to import the rules from the .htaccess file. Other than that it is really no different than deploying to any other server.
You can also use your company's local DNS to point to the server if you wish to access it via https://my-app.company.com.
May sure you all are one in common network
sudo php artisan serve --host 0.0.0.0 --port 81 (you can change the port if you want)
Other people will be able to access with you'r IP address http://your-pc-id-address:81

Bypass IP restriction SSH

I have a Laravel app with CI/CD setup at BuddyWorks which lets you create deployment pipelines.
I want to use SSH action to run some config scripts (artisan...) after uploading the source code.
Unfortunately, it turned out that SSH connectivity to the hosting server is restricted to my home country, ergo can’t use BuddyWorks to do the job for me. The hosting company refused my request to whitelist BuddyWorks IP’s.
So here am, looking for a solution to bypass restriction.
Currently, I’m investigating SSH reverse for , but not sure I’m on good path.
Any help would be appreciated!
I ended up writing a small http->ssh proxy server with basic authentication which receives commands from pipeline via post requests and connects to the host server via ssh, executes the commands and logs to slack.

Can't get Amazon EC2 instance work

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.

Replacing Rackspace Cloud SITES with Amazon EC2 Instances

So at work we run a bunch of sites on rackspaces cloud sites platform. This works alright, except I have no way of tweaking anything server side and I find that they sometimes aren't as responsive as they could be.
Let's assume that most of the sites are bloated wordpress installations.
Would it be possible to use EC2 micro instances to host these? (One instance per site)?
I want to move away from rackspace as I have no flexibility with cloud sites and prefer Amazons services.
Sure! You can easily do that!
Sign up for EC2 here.
Go to http://alestic.com/ and chose AMI (Ubuntu AMIs for EC2 drop-down) you want to start instance from.
Start EC2 Micro Instance by hitting the links (or use API Tools). You can use user-data to install desired software on instance start, but I recommend (for simplicity) just to start Instance and install software via terminal using SSH. Follow the dialog and create RSA key to connect your Instance.
Connect to your Instance over ssh using RSA key.
Install software. For example: sudo su, then apt-get update && apt-get install -y ntp php5-fpm nginx wordpress [...].
Create AMI from running Instance with installed and configured software.
Launch more Instances from your own AMI bundled with Wordpress and stuff!
Full disclosure: I am a rackspace employee.
If you want more flexibility than rackspace cloud sites, then you can use rackspace cloud server. You will have all the flexibility of the cloud. If you like the managed part of cloud sites, then i would suggest managed cloud server.

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