Simple Features Thoughts about simple features in software development


How to run visual apps from an Ubuntu EC2 instance (Ubuntu 13.10 server/Windows client)

First of all: don't try to make this if you actually want to watch streamed videos from an EC2 instance; you can do it if you spend enough money for such purposes. The intention of this setup is to display low quality plots being updated from Gnuplot since I'm studying some stuff that makes use of it.

Second: I will not get in depth in how to setup and initiate an instance since there is a lot of information available for this (and more important: I have contractual reasons not to talk about this without proper authorization).

Here I will just get into the details of what to setup after you have your instance ready and running and then set up what it takes to open the visual applications from your Windows desktop.

The part of setting up an EC2 instance can be achieved if we follow the instructions given in the following video up to the minute 04:45. If you keep on watching the video after that moment we will not get the final goal that we want:

The console as its shown is a bit different from what you will see since the video is a bit outdated, but the overall goal can be achieved with the information he's giving. We are using also a Ubuntu instance and the free tier version may work for this tutorial.

After doing what is in this video (before minute 04:45), we must have 3 things at hand:

  • We must download Putty and PuttyGen, which are two pieces of software that would allow us to connect safely to our EC2 instance from Windows. The software can be downloaded from here and there is no need to install it, it will just run;
  • we also must download Xming from here and install it by just following the default options. Xming will be the software that will receive the instructions from the instance of what has to be shown in our Windows box and then draws it in the screen. This is achieved via a protocol named X11 which beauty relies and that it just works;
  • we must have at hand the private key downloaded from AWS when we were creating our instance (02:09-02:21) and transformed with PuttyGen as shown in the video (03:06-04:00). Its original name had the extension .pem and now it has an extension .ppk. This private key has to be kept only in those computers that will connect to the instance: if you want to use two different computers to access such instance (or more instances if they share the same key) then share it between such computers, just don't email it to yourself because the security people gets mad and yells at you.

Once we have our previous requisites we should start with the following steps:

  1. Make sure that Xming is running. Its status will be shown in the notification area of the task bar:
  2. Open Putty, and first it will open in the "Session" options window. There you will write the name of the EC2 instance that you want to connect to. It is important to note that I added the username ubuntu at the beginning of the instance address: such user is by default in the Ubuntu instances from AWS and that is part of the instructions that Amazon will provide when setting up an instance.
  3. We now navigate in the left three to the Auth node, and there we will tell Putty to use our secret key provided by Amazon and transformed by PuttyGen. In specific we will select the .ppk file.
  4. The next parameter to set, is that Putty will serve as a gateway for the X11 protocol. We will enter the proper configuration window and set it:
  5. And since we don't want to do it over and over every time we want to use it, we save our configuration:
  6. Now, let's open the connection. It's a magical feeling. It will then ask you whether you are sure you want to connect to this instance. Just say "Yes".
  7. Now we will install stuff in the server, and then we will test that it works by running the program "xterm":
    $ sudo apt-get update
    $ sudo apt-get install xorg openbox
    $ xterm

  8. If the previous screen is visible then it means that it works. We are done if all you wanted is to make sure that X11 was working. Nevertheless, I said that I wanted to install gnuplot. You have to close the open terminal window and now we will type:
    $ sudo apt-get install gnuplot gnuplot-x11
    $ gnuplot
    gnuplot> plot sin(x)

    and there's sin(x), plotted, for you.

Filed under: devops No Comments

MySql Backup example script

As part of the poor man's high availability server array posts series, I include the following script that synchronizes  the master and backup database servers.

Filed under: devops Continue reading