Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Servers > Create Server

Create Server

Create a server in the specified cloud, deployment, from the given ServerTemplate, MCI, etc.

Reminder:  Not all clouds support all cloud resources.  For example, don't include a security group in your Create Server example if the cloud you are working with does not support security groups.

   

Table of Contents

Curl

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

Example Call

Note:  A "\" character has been added to allow a single curl command to continue for several lines in the editor.  This is for readability sake.  The shell will interpret the script's curl command as a single line.

#!/bin/sh -e
DEPLOYMENT="306795001"  # Deployment to add Server to
CLOUD="2112"            # Specify Cloud to add Server to
ST="250769001"          # Set the ServerTemplate the Server will be based on
SG="DEU7O32167MJ4"      # Set the Security Group
MCI="240802001"         # Set MultiCloud Image (MCI)
ITYPE="9F6N6MA39F7E9"   # Set the Instance Type for this Sever, this cloud, ...
curl -i -H X_API_VERSION:1.5 -b mycookie -X POST \
-d server[name]=my_app_server \
-d server[description]=my_app_server_description \
-d server[deployment_href]=/api/deployments/$DEPLOYMENT \
-d server[instance][cloud_href]=/api/clouds/$CLOUD \
-d server[instance][server_template_href]=/api/server_templates/$ST \
-d server[instance][multi_cloud_image_href]=/api/multi_cloud_images/$MCI \
-d server[instance][instance_type_href]=/api/clouds/$CLOUD/instance_types/$ITYPE \
-d server[instance][security_group_hrefs][]=/api/clouds/$CLOUD/security_groups/$SG \
https://my.rightscale.com/api/servers

Sample Output

Note: There is no XML/JSON content, just headers.

HTTP/1.1 201 Created
Server: nginx/1.0.15
Date: Mon, 19 Nov 2012 22:07:48 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201 Created
Location: /api/servers/589477001
X-Runtime: 2676
X-Request-Uuid: d3f28e8cb11c45c5862800201d350fa4
Set-Cookie: 
Cache-Control: no-cache

 

Postman

See the Create Server example (RightScale API 1.6 Guide:  Appendix A - APEye Tools > Google Chrome Postman Plugin)

See also

You must to post a comment.
Last modified
13:11, 17 Dec 2013

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.