Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Clouds > AWS > Tutorials > Beginner Examples > Basic Example

Basic Example


This tutorial will introduce you to some of the basic RightScale concepts and demonstrate how easy it is to set up and launch a web server on the Elastic Compute Cloud (EC2) using the RightScale Dashboard by using our various ServerTemplates and RightScripts. You will also learn how to create custom RightScripts and connect to your EC2 instance using an SSH console. Optionally, you can upload a simple web page and web application to the web server and then preview it in a browser window. 

Table of Contents


For best results, use Firefox, or Chrome.  IE8+ and Safari should also work though.

Create an Apache ServerTemplate

Let's begin by creating a new ServerTemplate and adding some RightScripts.  A ServerTemplate, defines the composition and configuration of your instance. When an instance is launched from a ServerTemplate, it uses a base OS image and a series of scripts to install and configure the Server as it boots. ServerTemplates help you get up and running quickly, while also giving you the flexibility to clone and customize these ServerTemplates, so that you can reuse and leverage all the pre-existing assets.

  • Go to Design > ServerTemplates > New


Note:  ServerTemplates are cloud-agnostic.  You can use the same ServerTemplate to launch instances in multiple clouds or AWS regions.  In this tutorial, you will launch an instance in the AWS US-East region.  

Next, you will provide some basic information about your new ServerTemplate.  


  • Name – Used to identify your Server in the Dashboard. Names are not case sensitive.
    Enter: apache webserver
  • Description – Brief description about your virtual machine instance.
    Enter: Installs and configures a simple apache webserver.
  • MultiCloud Image (MCI) - ServerTemplates themselves, are designed to be cloud-agnostic.  However, each ServerTemplate uses a MultiCloud Image.  It's the MultiCloud Image that determines which clouds are supported. You can only use a ServerTemplate, to create a Server in a cloud, for which its MultiCloud Image, has a machine image already defined. If possible, select an existing MultiCloud Image published by RightScale.  If one is not available, you can select the other option to create one now. If you are creating one from scratch, you will need to provide the following parameters. The reasons for needing to create an MCI from scratch can vary. It could be possible that the ServerTemplate you would like to use doesn’t have an MCI that points to a RightImage in a new Amazon region or you might need to use your own image to comply with your company’s policy. If you need to create one from scratch, provide a name for the MultiCloud Image object, select the cloud, instance type, and the appropriate machine image to use for that cloud.
    • Name - the name of the MultiCloud Image object you are about to create.
    • Cloud - the cloud (or AWS region) into which a new instance will be launched.  You can only specify one cloud at this time.  Later, you can add additional machine images for other clouds.
      • Select: AWS US-East
    • Machine Image - the base machine image that will be used to launch the instance.  For Amazon, it's called an Amazon Machine Image (AMI).  An AMI is a packaged environment that contains a configured Linux operating system. We recommend using our own custom RightImages, which contain a lightweight server installation with all of the tools necessary to use EC2 and RightScale. You must use a machine image that uses the correct architecture for the selected instance type (e.g. 32-bit for small and medium instance types; 64-bit for large and xlarge instance types). For this simple tutorial, use the 3-column Image selector window to select the latest 32-bit RightImage (i386) for the small instance type.
      • Select: RightImages  for Image Type
      • Select: RightImage_CentOS_5.4_i386_v5.x.x   (Use one of the most recent v5 RightImages.  For this example, do not select an image with a 'EBS' suffix.)
    • Instance type – describes the size of the EC2 instance.  See EC2 Instance Types.
      • Select: m1.small since you're using a 32-bit image.

Select the Save action button when ready.  A confirmation message will confirm that you created a new ServerTemplate and MCI.

Now you have a blank ServerTemplate that you can use to build an Apache web server.

Tag the MultiCloud Image for RightLink

Since you just created a new MultiCloud Image (MCI) from scratch that's using a v5 RightImage, which supports our latest RightLink technology, you will also need to tag the MCI so that RightScale will properly recognize it as a RightLink-enabled server when it's launched.  Servers that contain the RightLink agent are optimized to communicate with the RightScale platform.  RightScale will check for a specific RightLink tag on the MCI to determine if a server supports RightLink.

Note: If you are using a v4 RightImage (i.e. no RightLink support), you do not have to add a tag to the MCI.

Click on the ServerTemplate's Images tab to view the MCI that you just created.  Click on the text link to view the MCI.

Under the MCI's Info tab, click the Edit Tags text link.  Add the following RightLink tag: provides:rs_agent_type=right_link


Create and add a RightScript to the ServerTemplate

Create a RightScript

The next step is to add some extra functionality to the ServerTemplate, by inserting a RightScript.

A RightScript, is any script that you define within the RightScale Dashboard.  It may be a shell script, a Perl script, a Ruby script, etc.  There are three types of RightScripts that are attached to ServerTemplates

  • Boot Scripts - Scripts that run at boot time.
  • Operational Scripts - Scripts that can be run once a server is running.
  • Decommission Scripts - Scripts that run right before a server is terminated.

Note:  RightScripts can only be run on "operational" servers.  Servers that "strand" during the boot process cannot run RightScripts.

  • Go to Design > RightScripts > New.

As you create custom RightScripts of your own, they will be listed alphabetically under Design > RightScripts.  If you clone a published RightScript, you will create an editable copy.  Once a RightScript is defined, it can be used by any ServerTemplate in an account.

Create a new RightScript that installs Apache on the web server.


  • Name – the name of the new RightScript. (required)
    Enter: apache install
  • Description – brief description about the RightScript's functionality.
  • Packages – list of programs that will be automatically installed when an instance boots. Separate multiple packages by a comma or character space. (Ex: httpd, package2)  In this example we want to install Apache.
    Enter: httpd
  • Inputs – you can click the Identify button to scan the script for any variables that are capitalized. Once the server is operational, you can define a value for each variable.
  • Script – the code for the RightScript.  In this example, since Apache does not start automatically, enter the following line of code:
    service httpd start


Select the Save action button when ready.  A message will confirm that your RightScript was successfully created.

Add the RightScript to the ServerTemplate

Now that you've created the new RightScript, you need to add it to the "apache webserver" ServerTemplate you created earlier.

  1. Go to Design > ServerTemplates and click the apache webserver ServerTemplate that you just created. You can use the "Filter by" search box to help if you have many ServerTemplates in the list.


Hint:  Click the Help action button to toggle the context sensitive Help Text built into the RightScale Dashboard. The Help Text contains useful overview information to assist you wherever you are within the Dashboard. If you are not yet familiar with ServerTemplates and the MultiCloud Marketplace, please take a minute to read the Help Text.


  1. Click the ServerTemplate's Scripts tab.
    RightScripts can be added to ServerTemplates as either a boot, operational, or decommission script.  Because this RightScript is installing apache, you want it to automatically run when the Server boots. 
  1. Click Modify then the RightScripts tab to expose the list of available RightScripts.
  2. Click and drag your apache install script from the RightScripts pane onto the Boot Sequence section of the adjacent pane.



The "apache install" RightScript is now listed under the Boot Sequence section. This RightScript is configured to run at boot time whenever the “apache webserver” ServerTemplate is used to create a new Server.

Note:  Operational Scripts can be manually run when a Server is operational, whereas Decommission Scripts are executed during the shutdown phase in order to provide a more graceful server termination.

Launch the web server on EC2

You are now ready to launch a Server on EC2 using the new ServerTemplate. Servers are always launched within the context of a deployment.  Every RightScale account has a "Default" deployment, which is typically used for testing purposes only.  Most users create deployments for each of their projects.   Since this tutorial is designed for a quick demo, add it to the "Default" deployment.

Click Add Server from the Default deployment.

If you selected a MultiCloud Image that has machine images defined for multiple clouds, you will need to select into which cloud you want to launch a server. Select: AWS US-East


You may notice that the ServerTemplate has a [HEAD] label.  Since you can commit and create revisions of ServerTemplates and RightScripts, you can only make changes to the current [HEAD] version.  Think of the HEAD version, as a working copy.  (Note: It is not considered a best practice to use HEAD versions in production.)

You will be presented with an Add Server flow. For more information on the Add Server assistant, see Add Server Assistant.

  • Select the ServerTemplate you just created.
  • Here are basic descriptions for each field.  For suggested values that you can use for this tutorial, please see the "Suggested Values" section below.

Field Descriptions:

  • Deployment - A Server always exists within the context of a deployment.  Therefore, when you create a Server, you must specify into which Deployment the Server will be added.  Each RightScale account has a "Default" Deployment that's best used for testing purposes.  Select either the "Default" one or another Deployment that you've already defined.
  • ServerTemplate - Select the type of ServerTemplate from the pull-down menu.  When launching directly from a ServerTemplate, this has already been decided and will simply be listed in the dialog box.
    • Private - ServerTemplate from your private MultiCloud Marketplace.  That is, ServerTemplates that you either created from scratch, or imported and cloned.  These ServerTemplates are your own copy that you are free to customize.  They maintain their own lineage.
    • Imported - Anything you have imported directly from the MultiCloud Marketplace (which is a static copy).  Additionally, any ServerTemplates that you have subscribed to (which is a HEAD version, changing not a static revision.)
    • Then select the actual ServerTemplate name from another pull-down menu.  (e.g. Simple Linux Server)
  • Cloud -  What cloud the Server should be added to.  When adding a Server, this has already been selected via the Select Cloud action button, so in this dialog window you cannot alter it. It is simply displayed for informational purposes.
  • MultiCloud Image - Select the MCI to use or leave inherit from the ServerTemplate (default).
  • Instance Type - Select the Instance Type (e.g. small, medium, large, etc.) or inherit from the MultiCloud Image (default)
  • Nickname - Give a descriptive name for the Server's primary purpose.
  • SSH Key - Specify the (previously created) SSH Key to use.
  • Security Group - Select the (previously created) Security Group (or Groups) to use for security purposes.
  • Availability Zone - Select what Availability Zone (EC2) this Server should be in.  Recall that there are additional charges for traffic across zones.  Servers are typically placed in the same zone, unless the Deployment is working towards high availability across different zones. Some clouds have multiple zones or regions.
  • Elastic IP - Specify what EIP (or none) to use for the Server. 
  • Associate IP at launch - Normally you will leave this default (checked) so that an IP address is associated with the Server at launch. 

Suggested Values:

The following includes additional information and suggestions for filling out the Add Server dialog:

  • MultiCloud Image - Leave the default "Inherit from ServerTemplate"
  • Instance Type  - Leave the default "Inherit from MultiCloud Image"
  • VPC Subnet -  This example does not use a Virtual Private Cloud (VPC). If there is a field for this, leave the default "-None (public) - (used by the deployment)". 
  • SSH Key - By default, we've already created a default SSH key for you inside each AWS region.  Select: default-AWS-US-East
  • Security Group – You use more than one Security Group if required. Select a security group that allows connections over TCP port 80.
    Note: For running operational scripts with v4 RightImages, TCP port 22 is also required for SSH access.
  • Availability Zone – When you create a Deployment, you can specify a default Availability Zone that Servers will be launched into unless otherwise specified.  In this example, let's be specific Select: us-east-1a
  • Elastic IP –  Select: -none-
  • Associate IP at launch - Select: checkbox (by default, this should already be checked for you)


Verify your settings and select the Launch action button when ready.
Because Inputs were not specified in the ServerTemplate, no Inputs are listed, and the Server is ready to be launched. 

  • Select the Launch action button.  A message stating your Server is launched is displayed.


The instance is now being launched on EC2.  This can take a few minutes.  (Typically in the 5-10 minute range.) Under the Events pane, you can track the status of the Server's boot process. 


The "my webserver" instance that you just launched is now pending. The server will take a couple of minutes to complete the boot process.  In this example, the server should transition to the "operational" state without a problem.  However, it's useful to know that if a server ever becomes "stranded" you should still be able to SSH into the instance for troubleshooting purposes.  The next section will explain how to open an SSH console instance in more detail.

One of the main advantages of using ServerTemplates is that they ensure that new Servers are launched exactly how you configured them ... every time!  Depending how often you view the Events window and the "State" column, after a couple of minutes you should see the instance's status progress from "pending" to "booting" and finally to "operational." 

Once your Server is operational, click the my webserver link (Nickname column) to view general information for your running instance.



  • screen-ApacheHomepageSmall-v1.pngSelect the "Public DNS name" link to view your running EC2 instance in a new browser window.  We will reference this link again during the tutorial, so it will be helpful to keep this window open as a quick reference.


You should now see the Apache 2 Test Page in your web browser.  You should also receive an email from informing you that the 'apache webserver' instance is now operational.

Congratulations! You just launched a live web server on EC2! Anyone in the world can type in your Public DNS name (ex: and see the Apache 2 Test Page.

Connect to the instance using the SSH console

We provide you with three options with respect to using SSH to access your instances. From the RightScale dashboard use Settings > User Settings > SSH > Edit to configure your SSH client settings.


In this example, we will use the Java Web Start application option. By default, the web server that you just launched is currently pointing to an Apache homepage. Let’s create our own custom landing page using the SSH console.

  1. Go back to your server's Info page in the RightScale Dashboard and click on the SSH Console action button to “SSH” into the machine.screen-ssh-console-button_v1.png
  2. You should see two screens display, one Java connection window and one terminal window.


  1. In the event you are prompted regarding authenticity, enter 'yes' to continue. Once authenticated, your terminal screen should look similar to the following.



  • Occasionally, the very first attempt at ssh will fail.  If this happens, simply close out the launched windows and try again. 
  • If you do not have Java configured correctly, you will need to SSH in manually by following the client setup in this guide. See FAQ: How do I ssh into my machines?
  • If your instance does not have an SSH icon, it is likely that the SSH Key you selected does not have any key material.  In this instance, it is probably easiest to:
    • Create a new SSH Key
    • Edit your Servers configuration information (to use the new SSH Key you just created)
    • Terminate your Server
    • Launch your Server
  • If you still cannot SSH into your Server, it is likely the Security Group does not have port 22 open.  Consult the Create a Security Group tutorial on how to open up port 22 for SSH access.

Customize your Homepage

You are now logged into the instance. From this command prompt, create a file called, /var/www/html/index.html and paste the following code.

  • Type: vi /var/www/html/index.html to create an index.html file in the specified Apache docroot directory. Click Enter.
  • Type: i   to insert text.
  • Copy and Paste (Shift + Insert) the code below and click ESC.
  • Type: :wq  and click Enter.
     <title>Tutorial: Apache Server</title>
     <h1>Welcome to RightScale!</h1>

Reload your “my webserver.” Now refresh the preview in the browser window that is displaying the instance's public DNS link. Or you can go back to the Dashboard and click on the public DNS name to load the new homepage.  (You should not have to restart Apache, but if for some reason you need to in order to see your changes, enter the following command:  service httpd restart   from the SSH command prompt. Click Enter


Congratulations! You just logged into your EC2 instance using the SSH console and manually created a custom homepage for your Apache webserver. But, wouldn't it be great if we could somehow automate this manual process?

Upload files to the web server

Next, you'll create a new RightScript that will accomplish the same task achieved in the previous step of this tutorial. Except this time, you will also create an Input (variable) that will allow you to display different messages.

Go to Design -> RightScripts. Click New.

  • Nameconfigure homepage 
  • Script – Copy and paste the following code snippet.
cat <<EOF> /var/www/html/index.html 
     <title>Tutorial: Apache Server</title>

service httpd restart


Click Save.  The RightScale Dashboard header status message displays "RightScript was successfully added."

Click the Script tab and look at the list of Inputs. Notice that the RightScale Dashboard automatically recognizes the WELCOME_MESSAGE parameter!  Instead of hard-coding a message, we will use the WELCOME_MESSAGE variable, so that we can use the same script to display different messages.


Now add the new “configure homepage” RightScript to the “apache webserver” ServerTemplate. But this time, add it as an operational script. Operational Scripts behave similar to boot scripts, but they are not run when the instance boots.  Operational scripts are run on-command once a server is operational.

Go to Design -> ServerTemplates -> View Local. Select the apache webserver ServerTemplate.

Click the Scripts tab and add the configure homepage RightScript as an  operational script.


Notice that we're adding a script to the editable HEAD version of the apache webserver ServerTemplate.  Since we launched a server using the HEAD version of a ServerTemplate, we can add scripts to the ServerTemplate and the scripts will be available for execution on the running server.  This is a useful feature for development and testing purposes.   In production environments it is considered a best practice to only launch Servers using committed (static) ServerTemplate revisions.

After we've added this new operational script, we can execute this script from the running instance page.  But, before you run the instance again, specify a new value for the WELCOME_MESSAGE parameter.

Go back to the Dashboard's Deployments tab (or click on the RightScale logo) and click on the "my webserver" link.  You want to go to the running Server's page which is listed in the Default deployment section.

Now click on the Inputs tab. Click Edit.


To define the welcome message parameter, select Text and type RightScripts Rock! and click Save.

To run this new operational script, go to the Scripts tab and click the Run action button on the right.


The “configure homepage” operational script now appears in the Events pane.  (You may observe a brief transition from 'queued' to 'completed'.)  Once the task is 100% completed, take another look at the server's homepage in a browser window.  (Refresh your browser window.)  The message should have changed to "RightScripts Rock!"

If you accidentally closed the preview browser window, go to the Dashboard (click on the RightScale logo) and click on the public DNS link for the “my webserver.” You should now see the following page in a browser window.


In the example above, you defined the page’s <H1> tag to display the text “RightScripts Rock!."  This was accomplished by simple variable substitution using RightScript Inputs. 

Congratulations! You now have a RightScript that will display any text message that you define.


Upload a web application to the web server (optional)


Instead of creating a RightScript that loads a simple html page, we will upload a web application and create a RightScript that deploys an entire web application.


Download the following sample web application: webapp.tgz

Note: After downloading the file, make sure that the filename was not modified by your OS or browser settings.  Sometimes, extra characters will be added to the filename or the file extension may be changed or missing.  The file must be have correct filename.

Create a new RightScript called, deploy webapp.
Paste the following code into the Script field.

tar xzf $ATTACH_DIR/webapp.tgz -C /var/www/html/ 
service httpd restart 


Click Save

Since we are launching a web application, we need to attach the webapp file to the ServerTemplate. Click on the RightScript's Attachments tab.  Browse and upload the webapp.tgz file that you just downloaded.

Now click on the Script tab and take a closer look at code.


Notice the $ATTACH_DIR in the script.

RightScripts allow you to attach as many files as you want to a ServerTemplate. Simply prepend each filename with "$ATTACH_DIR/ ".

The next step is to attach the "deploy webapp" RightScript to the ServerTemplate.
Go to the "apache webserver" ServerTemplate. 

Click on the template's Scripts tab.  Add the "deploy webapp" as an operational script.



Go to  Manage -> Deployments -> View all.  Select the Default deployment and then click on the "my webserver" link. 

Click on the Scripts tab. 


To run the "deploy webapp" RightScript, click on the Run action button. 

After refreshing the preview window, you should see the new homepage of your EC2 instance, which is running the webapp.tgz web application.  (In this example, the web application is a simple html page.)


Post Tutorial Steps (optional)

  • To turn this example into a reusable server configuration for launching a generic website, simply change the “deploy webapp” RightScript from an operational script to a boot script.
  • If you have your SSH terminal window still open, you may want to issue a few command just to solidify what happened:
    • cd /var/www/html        # This is docroot, where your attached tarball was extracted to
    • ls                                # You should see index.html and myapp.tgz
    • tar tvf *.tgz                  # Reveals the "new"  index.html

Clearly this web application is very basic.  Having uploaded the zipped tarball, it extracts a new index.html and restarts Apache, resulting in the new homepage for your Apache webserver.  Of course, it could have done a lot more, and all of the key principles from this tutorial still apply.

  • When you are done testing the web application, don't forget to terminate your instance to ensure that completing this tutorial will only cost $0.10.  Go to Manage -> Servers and click on the Terminate action button for your Apache webserver.  Your SSH session will close down when the Server is terminated.
You must to post a comment.
Last modified
15:55, 29 Jan 2015



This page has no classifications.



© 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.