fbpx
GEThttps://api.spotinst.io/aws/ec2/group/{GROUP_ID}/costs?fromDate={fromDATE}&toDate={toDATE}&&aggregationPeriod=daily&accountId={ACCOUNT_ID}

Get financial information on a specific Elastigroup

URL Parameters

Parameter Type Description
GROUP_ID * String

The Elastigroup 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
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
}
Response - Get Elastigroup Costs

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
   "request":
   {
       "id": "50af37fb-8b81-4abb-90cc-7a6d4f6e9f1b",
       "url": "/aws/ec2/group/sig-48d79900/costs?fromDate=2018-03-06&toDate=2019-02-27",
       "method": "GET",
       "timestamp": "2019-06-13T06:58:00.930Z"
   },
   "response": {
       "status": {
           "code": 200,
           "message": "OK"
       },
       "kind": "spotinst:aws:ec2:group:stats",
       "items": [
           {
               "running": {
                   "value": 0,
                   "unit": "hours"
               },
               "savings": {
                   "value": 0,
                   "unit": "percentage"
               },
               "costs": {
                   "actual": 0,
                   "potential": 0
               }
           }
       ],
       "count": 1
   }
}
Response - Get Elastigroup Costs With Daily Aggregation Period

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
    "request": {
        "id": "8f68e2fa-15cc-4468-bef5-77e8ae6a9ba7",
        "url": "/aws/ec2/group/sig-48d79900/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:group:stats",
        "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
    }
}