Blog 3 – Test Environment

Last blog I got the Arduino reading just the UID to the Serial monitor. The next step will be getting the UID saved to a database. For my project I am going to be working with the cloud, specifically Amazon Web Services (AWS). I have chosen this cloud service provider as I have used them before and for most of my project I am covered under the free tier. This means that I can cut the cost of my project and still use the cloud to do it.
To get the UIDs saved to a cloud database I need to setup a test environment. For a start this will consist of a Linux server and a MySQL database. The Linux server will be made into a web server. For this I will need to start and setup a Linux server using the online AWS console, making sure that the settings I use keep it in the free tier.

Linux Server

The first check I always make it to check that my console is set to the correct region. If it isn’t then servers will be setup in another location from where you want them. I want mine is Sydney as it is the closest Amazon datacenter to my location.

22-08 EC2 and location.PNG

Amazon calls the servers EC2 units. I have done this before so i’m doing this from memory Below is a series of images detailing the Linux server setup;

22-08 Launch Instance

Once in the EC2 area click the Launch instance button to start a new server

22-08 Amazon Linux server select

I want a Amazon Linux server. I’ve selected the SSD type as it is still under the Free Tier and it will allow faster data handling

22-08 t2micro

I’m using the t2.micro server as it is covered under the Free Tier and will be fast enough for my needs

22 Instance settings

Settings used. These are the defaults

22-08 Instance Storage

The storage I kept the same except I increased the server size from 5GB to 10GB. As this is a test server I don’t know the size of the files I’ll be loading onto it. Therefore the extra size is a precaution. This will be adjusted for the final release.

22-08 Instance Security Group

I setup a new security group for my server. This will allow limited access to my server. I set access for on the IP address I am using meaning that only computers on the same location, that have the credentials can access it.

22-08 Instance KeyPair

When I tried to start the server this window poped up. This key is a file that will add extra protection. It limits the access to the command line and file upload to the server to people with the key. Download it and store in a secure location

22-08 Instance Inisilization

Above is the server starting. This may take some time.

22-08 Public DNS address

This is the public access address. This will be needed later to connect and configure the server

I need to remember to access the server I need to add my IP address to the security group.

Putty Connection

Once the server is started and running then I can configure it to be a web server. I haven’t setup my own webserver on a Linux server so I had to lookup how to do it. I found the most common and what appears to be the easiest to setup was a Apache server. This is a set of software that is installed onto the Linux server to turn it into a web server. AWS has its own user guide section and it includes a section on how to install a Apache server. First I need to connect PUTTY to my server. This allows me to interface with it in console form. In the AWS user guide there is a connection instruction manual. Below is setting up this connection;

22-08 Gen Key without Pphrase

Once Putty is installed. Open Puttygen and import the Key pair that AWS gave you earlier. Save the key in the .ppk format. This the format that Putty recognizes

22-08 Address into putty

Open Putty and copy the Host and User to the correct fields in Putty

22-08 Webserver key into putty

Go to the Auth section on Putty and select the Key that you generated earlier. Now you should be able to connect

22-08 Connected to AWS webserver

Connected to the Linux Server that I created earlier

Once big issue I had in the above section was when I was trying to connect. I opened putty and first went in and added the Key Pair first. Then I would add the Host details and try connect. The connection would fail due to incorrect credentials. I tried several times with the same result. I then tried adding the Host details first, then the Key Pair. This time it worked and I connection was accepted. After looking into it I found that when you add the Key Pair first and then the Host details, Putty thinks that is a new connection and clears the Key Pair. From now on I will need to remember to add my Key Pair after the Host details.

Apache Web Server

From the above point I continued on and setup my Apache webserver using the user guide;

22-08 Applying updates to webserver

First apply any updates that are available to the Linux server.

22-08 Apache webserver install complete

Next install the Apache webserver onto the Linux server

22-08 Starting Webserver

Once installed start the webserver.

22-08 Httpd start on reboot

Set the webserver automatically to start every time there is a reboot

22-08 Apache Test Page

Go to the Public IP address of the server. There should be this test page displayed

23-08 Adding user permissions to www file on webserver

Add permissions to the folders where the website files go to allow you to add files to it

I next downloaded and installed WinSCP. This allows you to transfer files to the web server. It connects in effectively to same fashion as Putty does. It then allows you to transfer files in the drag and drop window. I uploaded a website I made a few years ago to test that it all works. Below is the confirmation.

23-08 Test website.PNG


MySQL Database

I have setup a number of these before so I did it off the top of my head. I have included doing this before in a previous blog. This includes setting it up and configuring it using MySQL Workbench. I will be doing effectively the same thing again but using different credentials.
One big issue I ran into was when connecting MySQL Workbench to the database. I was on campus and trying to connect so that I could configure the database. But Workbench would not connect. I tried everything I could think of to get it to connect. I triple check that the credentials correct in both places but yet it still wouldn’t work. In the end I came to the conclusion that I could be the port that is blocked. To connect and configure the server you use port 3306 but if this is blocked on the NMIT network then I won’t be able to. To test it I went to a port checker website apporpitly named can you see me. This check to see if it can see your computer on a port. I tested port 3306 and it returned that it couldn’t see the computer. That confirmed that the port was the problem. I have since connected at home where I know the port isn’t blocked. I’ve emailed my supervisor about the problem.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s