When hosting websites on EC2 instances it’s pretty common to need to point multiple Elastic IPs to a single EC2 instance, normally to allow the use of multiple SSL certificates. This is pretty easy to do, but a little confusing at fist if your not used to the sysadmin world. It’s important to understand that each NIC (network interface) can only have a single elastic IP address bound to it. Most instances are not launched with spare NICs attached and as such you will have to create an attach and additional NIC to which you can associate (point) the additional elastic IP. Note: The number of NIC’s you can attached to an EC2 instance is limited by the size of the instance. For example a micro instance can at the point of writing only support two NICs (there for limiting you to using only two elastic IP’s). You can get around this by using a load balancer. Creating & attaching an additional Network Interface First log into your AWS account and pull up the EC2 Dashboard. From there select ‘Network Interfaces’ under Network & Security tab on the left hand menu and click ‘Create Network Interface’ (the big blue button at the top). A pop up will appear and you can name the new interface something meaningful to you. Then add it to the subnet that the EC2 server is currently in. (If your not sure which subnet this is you can find it by looking at the instance details on the ‘Instances’ page). Once you have selected a subnet the security groups available on that subnet will be listed. Select the groups to all through the traffic you need (you can always add more / change this later if you need too). If you want to manually assign the private IP address you can do so at this stage, but I tend to leave it blank which will auto assign an address for you…
As a web developer from time to time you inevitably have to cleans a database table of a few records – be they test data, corrupt data or whatever. Very occasionally (and rather unnervingly) this sometimes has to be done in a live environment on a busy table (sign up data etc etc). Standard practice is to take a backup of the table first. Inevitably sometimes it doesn’t quite go to plan, and a few days later you find there’s some data you need back. The query bellow is a simple one that will copy all data from the backup table, that is not in the live table, back into the live table. This leaves any additional or modified data in the live table in tact. The only pre-requisite is that there is a unique ID column (in the query below ‘ID’) for which to reference against.
An oldie but a goodie – Reset the file permissions on all folders and files through out a directory / site (755 for folders and 644 for files). Great for quickly securing a site full of 777 folders. find /folder -type d -exec chmod 0755 {} \; find /folder -type f -exec chmod 0644 {} \;