Instance
The Instance resource has two public URIs. (For information about the difference between Public and Internal URLs and HATEOAS conventions, please see API Structure and Conventions.) The first one is the canonical entry point for this service:
/v1/instances
The second one refreshes all instances and is accessed mainly by internal CronJobs:
/v1/instances/refresh
Structure
All attributes are read only.
- instance_id
- (String) The AWS instance id, e.g. i-123e064b.
- name
- (String) The name of the instance.
- description
- (String) Not used by Ocean.
- ocean_env
- (String) The Ocean environment in which the instance lives, e.g. master, staging, or prod.
- service
- (String) The name of the service to which the instance belongs, e.g. auth.
- subservice
- (String) Used for instances used to run other servers than Rails servers, such as redis, etc. If blank, the instance is a Rails service.
- state
- (String) The run state of the AWS instance, e.g. running, stopped, starting, stopping, terminated, etc.
- state_transition_reason
- (String) The reason for changing state.
- state_reason_message
- (String) The state reason message.
- instance_type
- (String) The type of AWS instance, such as m1.medium.
- launch_time
- (String) The UTC time when the instance last was started.
- vpc_id
- (String) The AWS VPC id.
- availability_zone
- (String) The AWS Availability Zone, such as eu-west-1c.
- subnet_id
- (String or Null) The AWS subnet where the instance lives, e.g. subnet-56db88a0.
- security_groups
- (Array) The AWS Security Groups to which this instance belongs, e.g. [{"group_name":"default","group_id":"sg-ae057ff2"}]
- private_ip_address
- (String) The private IP address of the instance.
- public_ip_address
- (String) The public IP address of the instance or null if none.
- metrics
- (Object) CloudWatch metrics for the past hour. Metric name strings are keys pointing to chronologically sorted array of values. The latest data point is at the end of the array. E.g.:
- {"NetworkIn":[["2015-11-21T23:57:00Z", 163155], ["2015-11-22T00:02:00Z", 140177], ["2015-11-22T00:07:00Z", 55089], ["2015-11-22T00:12:00Z", 145379], ["2015-11-22T00:17:00Z", 280040], ["2015-11-22T00:22:00Z", 179981], ["2015-11-22T00:27:00Z", 78181], ["2015-11-22T00:32:00Z", 153989], ["2015-11-22T00:37:00Z", 151983], ["2015-11-22T00:42:00Z", 175692], ["2015-11-22T00:47:00Z", 80677]],
- "CPUUtilization":[["2015-11-21T23:57:00Z", 15.33], ["2015-11-22T00:02:00Z", 14.33], ["2015-11-22T00:07:00Z", 13.67], ["2015-11-22T00:12:00Z", 14.33], ["2015-11-22T00:17:00Z", 16.72], ["2015-11-22T00:22:00Z", 15], ["2015-11-22T00:27:00Z", 13.67], ["2015-11-22T00:32:00Z", 15.08], ["2015-11-22T00:37:00Z", 15.25], ["2015-11-22T00:42:00Z", 15.93], ["2015-11-22T00:47:00Z", 14.24]],
- "NetworkOut":[["2015-11-21T23:57:00Z", 330569], ["2015-11-22T00:02:00Z", 246629], ["2015-11-22T00:07:00Z", 57112], ["2015-11-22T00:12:00Z", 244942], ["2015-11-22T00:17:00Z", 853125], ["2015-11-22T00:22:00Z", 356824], ["2015-11-22T00:27:00Z", 162204], ["2015-11-22T00:32:00Z", 323645], ["2015-11-22T00:37:00Z", 318804], ["2015-11-22T00:42:00Z", 896931], ["2015-11-22T00:47:00Z", 207711]]}.
- created_at
- (String) A datetime string in UTC.
- updated_at
- (String) A datetime string in UTC.
Hyperlinks
The following hyperlink names are used in the following subsections. To retrieve the URL and Content-Type
to use, use the _links
hash. Note that the URI may change, and thus you should make no inference on how to construct similar URIs from any previous URI. For more information, refer to Hyperlink URIs are Opaque. You may store hyperlink URIs in permanent storage for later use.
- self
- The
self
hyperlink can be used to retrieve the Instance resource via a GET. Instances are read-only. - reboot
- Appears only when the instance is running. A PUT to this hyperlink will reboot the instance.
- start
- Appears only when the instance is stopped. A PUT to this hyperlink will start the instance.
- stop
- Appears only when the instance is running. A PUT to this hyperlink will stop the instance.
- terminate
- Appears only when the instance is stopped. A PUT to this hyperlink will terminate the instance.
GET self
Retrieves an Instance resource. You can match and group on the following attributes:
- instance_id
- name
- ocean_env
- service
- subservice
- state
- 200
- The operation was successful.
GET /v1/instances
Retrieves all Instances.
- 200
- The operation was successful.
PUT /v1/instances/refresh
Refreshes the local DB of instance data from AWS live data.
- 204
- The operation was successful. No body was returned.