Drupal on the Cloud
33
Sign In There’s a lot of options for hosting your Drupal site, but a lot of them are too restricted or just not setup right for Drupal. If you want a flexible and powerful host that you have full control over, then you may be interested in using Amazon’s EC2 cloud hosting. In this session, I’ll go through how to deploy your own hosting server and setup a standard hosting environment. I’ll be covering:
- Instance types
- Pricing
- Reserved Instances
- Security Groups
- Elastic Block System
- AMI Selection
- SSH
- LAMP Setup
- Backups
- Changing instance types
- Login to post comments
Comments
Great presentation
Any chance you will share your nifty backup script?
Sure, here’s it with
Sure, here’s it with placeholders for the keys, and a reference to the installed AWS SDK for PHP (http://aws.amazon.com/sdkforphp/).
<?php
require_once ‘/usr/share/php/AWSSDKforPHP/sdk.class.php’;
// Connect to EC2
$backup_retention = strtotime(’-7 days’);
$key = “XXXXXXXXXXXXXXXXXXXX”;
$secret_key = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;
$ec2 = new AmazonEC2($key, $secret_key);
// Backup Volumes
$response = $ec2->describe_volumes();
if ($response->isOK()) {
foreach ($response->body->volumeSet->item as $volume) {
$response = $ec2->create_snapshot((string) $volume->volumeId, ‘backup’);
}
}
// clear any snapshots that were auto created
$response = $ec2->describe_snapshots(array(
‘Filter’ => array(
array(‘Name’ => ‘status’, ‘Value’ => ‘completed’),
array(‘Name’ => ‘description’, ‘Value’ => ‘backup’),
),
‘Owner’ => ‘self’,
));
if ($response->isOK()) {
foreach ($response->body->snapshotSet->item as $snapshot) {
$backup_date = strtotime($snapshot->startTime);
if ($backup_date < $backup_retention) {
$response = $ec2->delete_snapshot((string) $snapshot->snapshotId);
}
}
}