• Blocking IP’s while behind an Amazon ELB with Apache

    So Amazon does not allow accept/deny rules on their firewall system which is beyond silly in this day and age, but I digress. If you want to limit access to an apache server behind Amazon’s Elastic Load Balancer, your options are fairly sparse (although there are options).

    One such way to accomplish this is to first allow logging of the IP from the ELB using the X-Forwarded-For header. You can see how to do this here.

    So once you have setup logging of the IP’s in the apache logs, you now want to adjust the site configuration files. We have individual files in /etc/apache2/sites-available, so we add the following to the specific site. You may do something similar or you may have it all in a httpd.conf, or you can even put this into a .htaccess file.
    Read the rest of this entry »

    Share
  • Logging IP’s on Apache while behind an ELB

    We recently had an issue where we had to track the IP’s of the remote hosts connecting to the servers behind our Amazon elastic load balancer. In order to accomplish this we had to adjust the LOGFORMAT of the apache server to log that X-FORWARDED-FOR header that is sent by the ELB. This can vary depending on the server, but you will either need to edit your httpd.conf or apache2.conf file (often in /etc/apache2/).

    Add the following to your apache config (comment out the existing settings).
    Read the rest of this entry »

    Share
  • Easily increase the size of your Ubuntu EBS boot volume with only console

    So you have run out of space on your EBS boot volume on Amazon’s EC2 and you do not know what to do? I will walk you through the steps you need to follow in order to easily increase the size of the default Ubuntu EBS boot drives (/dev/sda1) using just the Amazon webservices console. There is no need to use the ec2 command line tools, and you will only need to run one little command on the remote server when complete.




    Read the rest of this entry »

    Share
  • Simple guide for load balancing and scaling on Amazon

    Let’s say you have a simple website that you are expecting to go viral due to some news story or other potential viral type publicity. If you are hosted on Amazon, you have the capability to turn your little website into a monster with just a few clicks in the Amazon web console.

    The first thing you have to know is what is powering your website. Are you running a database and is the database on the same server? We are going to assume you are running a simple database and site all on the same server.
    Read the rest of this entry »

    Share
  • FTP script to automate file transfers to remote server

    Below you will find a FTP script that will allow you to automate your files transfers without requiring any user input. The only problem with this method is you will be putting a username and password into the script file, but having a simple automated FTP file upload or FTP file download probably outweighs the drawback.

    So to describe what this script does:
    First the script will tar and zip all files and folders in the /var/log/ folder to the home directory of the user who runs the script. This will create a dated zip file in the user’s home folder who ran the script. Then it will FTP the files to the remote host. You can then add the script to a cron job to execute it everyday, week, hour, etc.
    Read the rest of this entry »

    Share