Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to perform some maintenance, which involves down-times of my EC2 production server. I would like to serve some user friendly Maintenance page meanwhile.

The easiest solution, I was able to come up with, is to grab some minimalistic Micro instance AMI, setup the static page there and associate our public elastic IP to that instance during the maintenance.

The questions are:

(1) Is there an easier way (i.e. to serve some static page from s3, without need for EC2 instance)? [please note, that I don't want any dns caching delays, I prefer immediate switch like with ec2-associate-address]

(2) If there is no easier way, which AMI to start with (so that it can run on micro instance and preferably boots from EBS, so that could be easily persisted)?


Update:

For the record, here is the solution I used:

  1. Create micro instance from any ami found on http://alestic.com/
  2. Install nginx: sudo aptitude install nginx
  3. Now you can start/stop/restart it using sudo /etc/init.d/nginx start/stop/restart
  4. Edit Nginx config file sudo pico /etc/nginx/nginx.conf
  5. Instead of the include /etc/... row paste the following:
server {   root        /var/www/nginx-default;

  location / {
       if (-f $document_root/error503.html) {
            return 503;
       }   }

 # error 503 redirect to error503.html
    error_page 503 @maintenance;
    location @maintenance {
          rewrite ^(.*)$ /error503.html break;
    }
  1. Create the page (the folder should already exist) /var/www/nginx-default/error503.html and remove the /var/www/nginx-default/index.html.
  2. Start/Restart Nginx sudo /etc/init.d/nginx start
  3. Now you are done and you could use ec2-associate-address YOUR-IP -i YOUR-INSTANCE-ID to map your public IP between the production server and this maintenance-page serving instance.
share|improve this question

2 Answers 2

up vote 7 down vote accepted

The only fastest way is that which you have mentioned already, that make a small ami and host a static maintenance page on it, by attaching elastic IP to it. There is no hard and fast rule that which AMI should be used in this scenario. Any micro instance of Debian/RHEL/Ubuntu would work fine.

share|improve this answer
    
Thanks, you made me to do it ;-) –  Michal Dec 9 '11 at 11:15

I guess that if you already have a second Amazon EC2 instance, you only need to redirect the Elastic IP attached to the target instance and attach it to the second VM just for the downtime. A new vhost with a redirection rule that catches all requests to this maintenance page should do the trick.

share|improve this answer
    
The point was, that I had only one instance and I was looking for a fast way to create the second one (which serves the maintenance page). Since no easier solution was provided, I pasted my steps to setup the second machine in the update. The elastic IP mapping is the very last step of the whole procedure. –  Michal Apr 15 '13 at 12:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.