Setting Up An Amazon Web Service

Most of the software I write at work can’t be included in my blogs for obvious reasons, but when it comes to research over the holidays, that is a different matter. In this case I’m planning to move our applications across to AWS so I thought I would play round with it to see what was involved. I sure there are opportunities and pitfalls so the best way to find these is to have a go.

What I’m aiming at is cloud hosting for PHP applications, their databases and lots of file storage (photos and video). We will start with PHP 7 and resolve any compatibility problems as we migrate.

1.  Set up a free AWS account

https://portal.aws.amazon.com/gp/aws/developer/registration/index.html

Although its a free account, you have to enter credit card details. I’m a bit worried that I might start getting changed for things when not expecting it. I must keep track of options I select, to make sure they are free (for now anyway).

2. Build Your Virtual Machine

As a part of signing up you get the following options. I chose Launch a virtual machine. You also need to give it a name (GregsTest).

Then choose an operating system. I started with Amazon Linux, but got stuck trying to get PHP7 working. I changes to Red Hat Linux.

You then need to choose an instance type. Might as well go for something small and free for now.

Finally we need to set up private key. You keep this on your machine, and it gets used whenever you connect into your instance. AWS keep your public key.

Be sure to keep a safe copy of this private key as without it you are lost. AWS don’t keep it so you are on your own.

In this case the download will be a file GregsTest.pem

I know we have chosen everthing, but somehow we need to go through it again. We are asked to choose a machine instance as below. As mentioned, I went for Red Hat

Then an instance type

It will build now and then show you a list of your instances as follows.

You can connect to your instance with ssh as follows.

Not this refers to your private key. In this example the pem file is in the current directory but this may not always be the case. You will go straight into the shell on the new instance. There is no user name and password as the public/private keys have been used for authentication.

3.  Install Apache and PHP 7

All you need is this

And this

Well that’s it. You should be able to open that in a browser,using the AWS URL