Sunday, February 22, 2015

Perl on Amazon Ec2 Linux AMI: Can't locate Class.pm in @INC when using Path::Class

This error is fixed by using the following command:

sudo perl -MCPAN -e 'install Path::Class'

Install GCC on the Amazon Linux AMI instance

1. Connect to your instance using the following command (I'm using MAC OS Terminal):
sudo ssh -i Key.pem ec2-user@Public_IP

2. Launch the following command to install GCC:
sudo yum install gcc

3. Verify gcc is installed:
gcc --version

Saturday, February 21, 2015

Simple XSLT Example


1. Following XML is received as input

<?xml version="1.0" encoding="UTF-8"?>
<Teams>
<team>
<title>Real Madrid</title>
<country>Spain</country>
</team>
<team>
<title>Arsenal Londra</title>
<country>England</country>
</team>
</Teams>



2. Following code is transforming the above XML into HTML format:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <h2 style="font-family:arial">European Football Teams</h2>
    <table border="0" style="font-family:arial">
      <tr bgcolor="#9a0000" style="color:#fff">
        <th style="text-align:left">Name</th>
        <th style="text-align:left">Country</th>
      </tr>
      <xsl:for-each select="Teams/team">
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="country"/></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>


3. And the HTML output:


More information when creating a new SSTP VPN connection to an Amazon AWS Windows Server


After creating a new SSTP connection and installing the certificate there are some additional steps that can be followed.

Those are in order not to route all Internet Traffic through the Amazon AWS Windows VPN and NAT server.

Here are the steps:

1. Right click the VPN connection adaptor -> Go to Properties and under Advanced config make sure "Use default gateway on remote network" is unchecked.

2. Connect to the VPN Server

3. As connection is succesful, there are no active routes to the private network instances. In order for this to be possible, following command needs to be run as administrator:
route add 10.0.1.10 mask 255.255.255 172.19.3.0

where:
10.0.1.10 - Private IP of the instance to be accessed via RDP
172.19.3.0 - VPN IP for the VPN and NAT Windows Server

4. You should now be able to RDP into the private instance.

5. The newly added routes should be automatically removed on VPN disconnect. If not, they can be automatically removed using:
route delete 10.0.1.10