Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Dashboard Users Guide > Design > MultiCloud Images > Actions > Create a Custom RightImage for Faster Boot Times

Create a Custom RightImage for Faster Boot Times

Objective

To modify a custom RightImage that will result in faster launch times.

Note: The instructions below apply to EC2 machine images.

Table of Contents

Prerequisites

  • 'actor' user role privileges

Overview

If you build a custom ServerTemplate that contains boot scripts that download large packages, you may experience very long server launch times (e.g. greater than 30 minutes). In such cases, you may want to include some of the large packages as part of the image in order to reduce overall server launch times. This tutorial describes the recommended steps for building a custom RightImages for optimal launch times.

Although it's a recommended best practice to use one of the base RightImages that were published with the ServerTemplate, there may be certain conditions (such as long boot times) that require you to build a custom RightImage. In such cases, it's strongly recommended that you follow the steps outlined below, which will make it easier to receive support from RightScale's Support team. It's difficult to troubleshoot a server that was launched with a custom RightImage because identifying all of the changes that were made to the underlying image can be difficult.

RightScale's RightImages create a root disk on the instance that's 10GB in size. Data that is stored in the ephemeral drive or in mounted voumes is not preserved and is included in a bundled image. Therefore, you cannot include an attachment that is 10GB in size. If you want to include a package that is larger than 10GB in size, you can use a snapshot that will create and attach a volume to the instance at boot time.

Steps

Linux

  1. Create a custom ServerTemplate that launches a fully configured server according to your specifications.
  2. Launch a few test servers using the ServerTemplate to record the average launch time.
  3. The next step is to clone the custom ServerTemplate, which you will use to create a custom RightImage. Name the ServerTemplate accordingly (e.g. "Image Builder").
  4. Under the cloned ServerTemplate's Scripts tab, remove all of the scripts from the Boot Script section EXCEPT for the custom RightScripts that install those large packages including the core set of RightScripts that are common to most ServerTemplates published by RightScale that set up monitoring, logging and timezone. In the example screenshot below, only the 'App A - Install Package (5GB)' script is kept in the boot list because it installs such a large package (5GB). If a script had to download 5GB of data each time a server is launched, it would take a long time to finish the boot script phase. Alternatively, you could also create a single script that will install and configure any applications and packages that you want to be permanently included at the image level. 

    screen-Scripts_Remove-v1.png
  5. Use the "Image Builder" ServerTemplate to launch a server into the cloud/region where you want to build your custom image. (Remember, images are cloud/region-specific and can only be used to launch servers in the same cloud/region.) 
  6. Clean the instance before you bundle a running instance and create a machine image of the VM. The clean-up process ensures that subsequent instance launches using the created image will be unique and not inherit previous SSH keys. For example, you will need to remove ssh keys, logs, rightlink state, etc. The commands may be different depending on the RightLink version.
    • SSH into the instance. For instances launched with a RightImage using RightLink v5.8+, switch to the 'root' user so that you can access and modify the directories below.
      • $ sudo -i
    • Remove SSH Keys
      • # rm -vf /home/rightscale/.ssh/* (for RightLink v5.8+)
    • Clear the Temp Directory
      • # rm -rvf /tmp/*
    • Remove State
      • # rm -rvf /var/cache/rightscale
        # rm -vf /etc/rightscale.d/*.js (for RightLink v5.7 or earlier)
        # rm -rvf /var/lib/rightscale (for RightLink v5.8+)
        # rm -rvf /var/spool/cloud/*
        # rm -vf /opt/rightscale/right_link/certs
  7. Once the server becomes operational, click the Bundle button. Wait for the bundled image to be completed. The process can take several minutes (~20 min).
  8. (Optional) If the bundled EC2 image is going to be used in a different RightScale account, you will need to also share the image with the other accounts. (e.g. Share an Amazon Machine Image (AMI))
  9. Repeat steps 5-7 to create the same image in other clouds/regions.
  10. Create a New MultiCloud Image (MCI) and add references to the custom images that you created across the different clouds/regions. Don't forget to tag the MCI with the appropriate RightLink tag.
  11. Clone the original ST again, except this time you must remove the scripts from the Boot Script list that were used in the "Image Builder" ServerTemplate to build your custom image. Add the new MCI to the ServerTemplate and remove any other MCIs that you no longer want to be included. Make your new MCI the "Default" MCI for the ServerTemplate.
  12. Create and launch a server with the optimized ServerTemplate and compare the launch time against the original server. You should notice a significant reduction in the total launch time. Commit the ServerTemplate to save the changes or modify the "Image Builder" ServerTemplate to make further adjustments as necessary. 
You must to post a comment.
Last modified
22:31, 16 May 2013

Tags

This page has no custom tags.

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.