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.
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.
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;
I need to remember to access the server I need to add my IP address to the security group.
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;
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;
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.
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.