Home > Guides > RightScale API 1.0 > RightScale API 1.0 Examples

Copyright (c) 2006-2014 MindTouch Inc.

This file and accompanying files are licensed under the MindTouch Master Subscription Agreement (MSA).

At any time, you shall not, directly or indirectly: (i) sublicense, resell, rent, lease, distribute, market, commercialize or otherwise transfer rights or usage to: (a) the Software, (b) any modified version or derivative work of the Software created by you or for you, or (c) MindTouch Open Source (which includes all non-supported versions of MindTouch-developed software), for any purpose including timesharing or service bureau purposes; (ii) remove or alter any copyright, trademark or proprietary notice in the Software; (iii) transfer, use or export the Software in violation of any applicable laws or regulations of any government or governmental agency; (iv) use or run on any of your hardware, or have deployed for use, any production version of MindTouch Open Source; (v) use any of the Support Services, Error corrections, Updates or Upgrades, for the MindTouch Open Source software or for any Server for which Support Services are not then purchased as provided hereunder; or (vi) reverse engineer, decompile or modify any encrypted or encoded portion of the Software.

A complete copy of the MSA is available at http://www.mindtouch.com/msa

RightScale API 1.0 Examples


Sometimes the best way to learn is by studying some real world examples to see how things work and hopefully understand how you can apply it for your own purposes. The examples below cover some common use cases of the RightScale API and if you're savvy, you'll also be able to deconstruct them to extract specific code snippets for accomplishing more specific tasks.

The examples are written in Bourne shell or Bash. RestConnection examples are also available.

Using rs_api_examples

All the Bash/cURL examples in this section resided in rs_api_examples. Each example sources configuration from ~/.rightscale, logs into the API then performs the required API calls.


RightScript install

For RightScale Servers and Server Array instances, import the Install & configure rs_api_examples RightScript from the MultiCloud Marketplace.
Add this to your ServerTemplates or use as an Any Script. Inputs are provided for your RightScale credentials (skip the configuration section below).

RightScale/EC2 API Toolbox

You can get started within minutes by importing the RightScale/EC2 API Toolbox from the MultiCloud Marketplace, adding it to a deployment, filling in the missing inputs for your credentials, then launching the server. Once operational, you'll find that each command in the package, e.g. rs-login.sh is available in the shell's path.

Manual install

This is ideal for any unix-like desktop or virtual machine that is not attached to RightScale.

#!/bin/sh -e

install_dir="$HOME/bin"     # non-root
#install_dir=/usr/bin       # root

mkdir -p "$install_dir"
cd /tmp
git clone git://github.com/flaccid/rs_api_examples.git
cp -vR /tmp/rs_api_examples/bin/* "$install_dir"/
chmod +x "$install_dir"/rs-*.sh
rm -Rf /tmp/rs_api_examples


Add rs_api_examples to search path

Add to user's shell profile

for f in "$HOME"/{.bash_profile,.bash_login,.profile}; do
    if [[ -f $f ]]; then
        echo "PATH+=':$install_dir'" >> "$f"; break;

Or, add to current shell path

Configure credentials and API version
Interactive setup
# <follow the prompts>

Note, your RightScale account ID can be found after 'acct/' in URLs when browsing my.rightscale.com, e.g. https://my.rightscale.com/acct/1234/dashboard;overview

#!/bin/sh -e


mkdir -p "$HOME/.rightscale"

cat <<EOF> "$HOME/.rightscale/rs_api_config.sh"
cat <<EOF> "$HOME/.rightscale/rs_api_creds.sh"
Test Authentication
Switching Accounts
rs-switch-accounts.sh 1234    # where 1234 is the account ID

List of Examples

You must to post a comment.
Last modified
21:57, 16 May 2013



This page has no classifications.



Glossary | 用語용어 Site Map | Site Help Community Corporate Site Get Support Dashboard Login
Doc Feedback Product Feedback Resources MultiCloud Marketplace Forums

Dashboard Status

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