• 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
  • 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