GEThttps://api.spotinst.iohttps://api.spotinst.io/aws/ec2/managedInstance/\{MI_ID}/costs?fromDate={fromDATE}&toDate={toDATE}&aggregationPeriod={AGGREGATION_PERIOD}&accountId={ACCOUNT_ID}

Get financial information on a specific managed instance.

To use this API, managedInstanceId must be defined.

URL Parameters

Parameter Type Description
MI_ID * String

The Managed Instance ID you want to query

fromDATE * String

Data values following either a date format (YYYY-MM-DDTHH:mm:ss.SSSZ ; 2016-01-10T00:00:00.000Z) or Unix seconds Timestamp (1494751821)

toDATE * String

Data values following either a date format (YYYY-MM-DDTHH:mm:ss.SSSZ ; 2016-01-10T00:00:00.000Z) or Unix seconds Timestamp (1494751821)

aggregationPeriod String

Optionally add aggregation period to response. Valid values: "daily"

Example: daily
ACCOUNT_ID String

Your Spotinst accountId associated with your token

Example: act-123abc
Request - Get Elastigroup Costs Without Aggregation Period

Headers
Copied!
Downloaded!
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
}
Response - Get Elastigroup Costs

Headers
Copied!
Downloaded!
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "request": {
    "id": "14c3ab17-47ca-4081-aa55-c94955002ed8",
    "url": "/aws/ec2/managedInstance/smi-12345/costs",
    "method": "GET",
    "timestamp": "2015-07-14T15:36:41.423Z"
  },
  "response": {
    "status": {
      "code": 200,
      "message": "OK"
    },
    "kind": "spotinst:aws:ec2:managedInstance:costs",
    "items": [
      {
        "running": {
          "value": 4,
          "unit": "hours"
        },
        "savings": {
          "value": 0,
          "unit": "percentage"
        },
        "costs": {
          "actual": 0.268,
          "potential": 0.268
        }
      }
    ],
    "count": 1
  }
}
Response - Get Elastigroup Costs With Daily Aggregation Period

Headers
Copied!
Downloaded!
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
    "request": {
        "id": "8f68e2fa-15cc-4468-bef5-77e8ae6a9ba7",
        "url": "/aws/ec2/managedInstance/smi-12345/costs?aggregationPeriod=daily&fromDate=2018-03-06&toDate=2019-02-27",
        "method": "GET",
        "timestamp": "2019-06-13T06:56:05.385Z"
    },
    "response": {
        "status": {
            "code": 200,
            "message": "OK"
        },
        "kind": "spotinst:aws:ec2:managedInstance:costs",
        "items": [
            {
                "timestamp": "2018-03-06T00:00:00.000Z",
                "running": {
                    "value": 48,
                    "unit": "hours"
                },
                "savings": {
                    "value": 74,
                    "unit": "percentage"
                },
                "costs": {
                    "actual": 1.3104,
                    "potential": 5.04
                }
            },
            {
                "timestamp": "2018-03-07T00:00:00.000Z",
                "running": {
                    "value": 37,
                    "unit": "hours"
                },
                "savings": {
                    "value": 74,
                    "unit": "percentage"
                },
                "costs": {
                    "actual": 1.0101,
                    "potential": 3.885
                }
            },
            {
                "timestamp": "2018-03-08T00:00:00.000Z",
                "running": {
                    "value": 16,
                    "unit": "hours"
                },
                "savings": {
                    "value": 74,
                    "unit": "percentage"
                },
                "costs": {
                    "actual": 0.4368,
                    "potential": 1.68
                }
            }
        ],
        "count": 3
    }
}

API Permissions

{
             "regUrl": pathToRegexp('/aws/ec2/managedInstance/:managedInstanceId/costs'),
             "methods": [
               "GET"
             ],
             "permissionDefinitions": [
               {
                 "actionDefinitions": [
                   {
                     "description": "",
                     "pattern": "managedInstance:describeManagedInstanceCosts",
                     "mappingStrategy": "const",
                     "mappingKey": "null"
                   }
                 ],
                 "resourceDefinitions": [
                   {
                     "description": "",
                     "pattern": "*",
                     "mappingStrategy": "const",
                     "mappingKey": "null"
                   }
                 ]
               }
             ]
           }