Release v0.5.0
righteous is a Python client implementation of the RightScale API for EC2 instance management.
righteous provides an API and CLI to create, start/stop, delete, remove and introspect RightScale EC2 Servers. This library implements RightScale API 1.0 and has only been tested with EC2 instances using ServerTemplates and managed in a Deployment.
Create a file called ~/.righteous with the following customised contents:
[auth]
username: username@domain.com
password: password
account_id: 123
[server-defaults]
default_deployment_id: 45623
ec2_security_groups_href: https://my.rightscale.com/api/acct/123/ec2_security_groups/789
ec2_availability_zone: us-east-1a
ec2_ssh_key_href: https://my.rightscale.com/api/acct/123/ec2_ssh_keys/998
cloud_id: 1
server_template_href: https://my.rightscale.com/api/acct/123/ec2_server_templates/74732
instance_type: m1.small
m1.small: https://my.rightscale.com/api/acct/123/ec2_server_templates/74732
m1.large: https://my.rightscale.com/api/acct/123/ec2_server_templates/117240
righteous
Interact with the RightScale Server API.
Usage:
righteous [options] list
righteous [options] create <environment> <instance-type> (<server-template-key>=<server-template-value>)...
righteous [options] stop <environment>...
righteous [options] status <environment>...
righteous [options] delete <environment>...
righteous --version
Options:
-c FILE --config=FILE Specify the configuration file location, default is ~/.righteous
-v --verbose Show debug output
-h --help Show this screen.
Initialises righteous configuration
Parameters: |
|
---|---|
Params kwargs: | Key word arguments for additional configuration |
Logins to RightScale and stores the auth cookie for future requests
Parameters: |
|
---|---|
Returns: | Boolean indicating successful login |
Lists servers in a deployment
Parameters: | deployment_id – (optional) String representing Deployment to list servers from |
---|---|
Returns: | dict of server deployment information: http://reference.rightscale.com/api1.0/ApiR1V0/Docs/ApiDeployments.html |
Finds a server based on nickname
Parameters: | nickname – (optional) String representing the nickname of the server to lookup |
---|---|
Returns: | dict of server information with the following keys: |
[u'deployment_href', u'tags', u'created_at', u'server_type',
u'updated_at', u'server_template_href', u'current_instance_href',
u'state', u'href', u'nickname']
Detailed server information
Parameters: |
|
---|---|
Returns: | dict of server information with the following keys: |
[u'deployment_href', u'parameters', u'tags', u'created_at',
u'server_type', u'updated_at', u'server_template_href',
u'current_instance_href', u'state', u'href', u'nickname']
Current server settings
Parameters: |
|
---|---|
Returns: | dict of server settings with the following keys: |
[u'ec2-security-groups-href', u'private-ip-address',
u'ec2-ssh-key-href', u'private-dns-name', u'locked', u'dns-name',
u'pricing', u'cloud_id', u'ec2-availability-zone', u'aws-platform',
u'ip-address', u'aws-product-codes', u'aws-id', u'ec2-instance-type',
u'launched-by']
Creates and starts a server. Returns a tuple of operation status, href of the created, started server
Parameters: |
|
---|---|
Returns: | tuple of operation success and server href of the new instance |
Stops a server.
Parameters: |
|
---|---|
Returns: | requests.Response |
Deletes a server from RightScale
Parameters: |
|
---|---|
Returns: | Boolean of operation success/failure |
Lists ServerTemplates
Returns: | list of dicts of server information with the following keys: |
---|
[u'description', u'is_head_version', u'created_at', u'updated_at',
u'href', u'version', u'nickname']
Details ServerTemplate information
Parameters: | template_href – String representing the server template href |
---|---|
Returns: | dict of server template information, with the following keys: |
[u'description', u'is_head_version', u'created_at', u'updated_at',
u'href', u'version', u'nickname']
Create a new ServerTemplate
Returns a tuple of operation status, href of the created, started server
Parameters: |
|
---|---|
Returns: | tuple of operation success and new server template href |
Deletes a ServerTemplate
Parameters: | server_template_href – String of the ServerTemplate to delete |
---|---|
Returns: | Boolean of operation success/failure |
Lists server deployment in an account
Returns: | dict of server deployment information with the following keys: |
---|
[u'href', u'description', u'tags', u'default_ec2_availability_zone',
u'default_vpc_subnet_href', u'created_at', u'nickname', u'updated_at',
u'servers']
Finds a server deployment based on nickname
Parameters: | nickname – (optional) String representing the nickname of the deployment to lookup |
---|---|
Returns: | dict of deployment information with the following keys: |
[u'href', u'description', u'tags', u'default_ec2_availability_zone',
u'default_vpc_subnet_href', u'created_at', u'nickname', u'updated_at',
u'servers']
Detailed server deployment information
Parameters: |
|
---|---|
Returns: | dict of deployment information with the following keys |
[u'href', u'description', u'tags', u'default_ec2_availability_zone',
u'default_vpc_subnet_href', u'created_at', u'nickname', u'updated_at',
u'servers']
Creates a server deployment
Parameters: |
|
---|
Deletes a server deployment
Parameters: |
|
---|---|
Returns: | Boolean of operation success/failure |
Duplicates a server deployment
Parameters: |
|
---|---|
Returns: | tuple of operation success Boolean and deployment href of the duplicated instance |