CostGuard API
CostGuard enables you to identify areas within your infrastructure that are ripe for cost optimization. Finout’s CostGuard API lets you retrieve all your CostGuard Scans and their relevant recommendations. This guide offers comprehensive information on interacting with the API endpoints to retrieve scan data, access recommendations, and manage resources.
GET
/Scans
GET
/Scans
Retrieves all CostGuard scan options. For more information, see CostGuard - Scans.
Prerequisite
Generate a Client ID and Secret Key from Finout to add in Headers.
Request
https://app.finout.io/v1/cost-guard/scans
Response
Returns a JSON object with the following properties:
request Id - The ID of this specific request.
scanName: The names of the scan.
scanId: The unique identifier of the scan.
scanLastRunTime: The last time the scan was run.
scanMetadata: Information about the scan.
type - The scan type.
costCenter - Origin of the scan’s cloud provider.
analysisDays - The number of days on which the scan analysis is based.
POST
/Scan Recommendations
POST
/Scan Recommendations
Retrieves all resources identified in a scan based on scanId, optional filters, and groupBy. For more information, see CostGuard - Scans.
Prerequisites
Generate a Client ID and Secret Key from Finout to add in Headers.
You must first GET the scan you want to query
Add the scan ID to the body of the POST query. Example:
{
"scanId": "scan_id"
}
Request
https://app.finout.io/v1/cost-guard/scans-recommendations
Body of Request
Parameter
Type
Description
scanId
string
The ID of the scan.
Example:
{
"scanId":"scan_id"
}
filters
Optional:
For Finout Megabill filters, see the Finout API language query doc.
Example:
"filters": {
"costCenter": "AWS",
"key": "parent_cloud_service",
"operator": "is",
"value": "AmazonAthena"
},
groupBy
Optional:
Group data elements together based on common attributes or values.
For Finout Megabill groupBy, see the Finout API language query doc.
Example:
"groupBy": {
"costCenter": "AWS",
"key": "parent_cloud_service"
}
Response
Returns a JSON object with the following properties:
requestId -The ID of this specific request.
scanName - The name of the scan.
scanLastRunTime - The last time the scan was run.
scanTotalCost - The sum of resources cost identified by the scan during the analysisDays.
scanTotalWaste - Waste of the scan during the analysisDays.
scanYearlyPotentialSavings - Yearly potential savings for the scan based on the scan's total waste.
scanMetadata - Additional information on the scan:
type - Scan type: rightsizing/idle
analysisDays - The duration in days on which the scan analysis is based
costCenter - scan cloud provider origin
data - All resources in a scan’s results
group - The value of the group. If there is no groupBy value, the value will be “Total”.
groupTotalCost - Cost of the scans during the analysisDays.
groupTotalWaste - Waste of the scan during analysisDays.
groupYearlyPotentialSavings - Yearly potential savings for the group based on the group's total waste.
resources - All resources in a scan’s results.
Scan Details
The details for the AWS, K8S, Datadog, and GCP scan recommendation queries.
AWS
EC2 - Idle
resourceMetadata
Field
Type
Description
Example Value
accountId
string
The account ID of the resource.
“1234”
accountName
string
The account name of the resource.
"finout"
instanceType
string
The type of the instance.
“t2.medium”
productVCPU
number
The core quantity.
“4”
resourceMetrics
Field
Type
Description
Example Value
maxEC2CpuUtilization
float
CPU Utilization percentage represents the peak CPU usage within the scan analysisDays. This value is determined by identifying the highest recorded CPU usage during the specified period, expressed as a percentage of the total CPU capacity.
“1.96721311475231”
totalEC2NetworkIn
float
The resource "NetworkIn'' represents the total amount of incoming network traffic within the scan analysis days. This value is determined by aggregating all recorded incoming network traffic data, providing a comprehensive measure of the total network usage for incoming data.
“2847257.3333333335”
totalEC2NetworkOut
float
The resource Networkout-
The resource "NetworkOut" represents the total amount of outgoing network traffic within the scan analysisDays. This value is determined by compiling all outgoing network traffic data recorded and provides a comprehensive measure of the total network usage for outgoing data.
“1976763”
EC2 - Rightsizing
resourceMetadata
Field
Type
Description
Example Value
accountId
string
The account ID of the resource.
“1234”
accountName
string
Account of the resource.
"finout"
instanceType
string
The size of the instance.
“t2.medium”
productVCPU
number
The core quantity.
“4”
resourceMetrics
Field
Type
Description
Example Value
maxEC2CpuUtilization
float
The maximum CPU usage during the analysis days.
“1.235593220338884”
usedCpu
float
The maximum CPU used during the analysisDays.
“1.235593220338884”
resourceRecommendations
Field
Type
Description
Example Value
targetCpu
float
Number of vCPU of the target instance.
1
targetMemory
float
The target of the memory.
512
targetInstanceType
string
The recommended instance type.
“t2.nano”
RDS- idle
resourceMetadata
Field
Type
Description
Example Value
accountName
string
The AWS account ID.
"finout"
instanceType
string
The size of the instance.
“t2.medium”
resourceMetrics
Field
Type
Description
Example Value
maxRDSDatabaseConnections
float
The maximum daily total of connections during the scan analysisDays.
0
RDS - Rightsizing
resourceMetadata
Field
Type
Description
Example Value
accountId
string
The account ID of the resource.
“1234”
accountName
string
AWS account ID.
"finout"
instanceType
string
The size of the instance.
db.r5.xlarge”
resourceMetrics
Field
Type
Description
Example Value
usedCpu
float
The maximum CPU used during the analysisDays.
“1.235593220338884”
usedMemory
float
The mximum memory that was used during the day's analysis.
“1.235593220338884”
maxRDSCpuUtilization
float
CPU utilization percentage- represents the peak CPU usage within the scan analysisDays. This value is determined by identifying the highest recorded CPU usage during the specified period and expressed as a percentage of the total CPU capacity.
“0.2”
resourceRecommendations
Field
Type
Description
Example Value
targetInstanceCpu
float
The scan results determined that the CPU of the target machine enables maximum CPU utilization without impacting performance.
1
targetInstanceMemory
float
The memory of the target machine.
512
targetInstanceType
string
The recommended instance type is based on the CPU scan result.
“db.r5.large”
Scans: EBS-Idle, EBS- rightsizing
Metadata
Field
Type
Description
Example Value
accountId
string
The account ID of the resource.
“1234”
accountName
string
Account of the resource.
"finout"
usageType
string
The type of the EBS.
“EBS:VolumeUsage.gp2”
state
string
The state of the EBS: Available - The EBS volume is not attached to any EC2 instance and is considered idle.
“Available”
Scans: EBS - gp2
Metadata
Field
Type
Description
Example Value
accountId
string
The account id of the resource.
“1234”
accountName
string
Account of the resource.
"finout"
usageType
string
The type of the EBS.
“EBS:VolumeUsage.gp2”
resourceRecommendations
Field
Type
Description
Example Value
targetVolumeType
string
The target volume type for the EBS.
gp3
Scans: Application Load Balancer - Idle, Network Load Balancer - Idle, Classic Load Balancer - Idle, Gateway Load Balancer - Idle
Metadata
Field
Type
Description
Example Value
accountId
string
The account IDof the resource.
“1234”
accountName
string
The account of the resource.
"finout"
apiOperation
string
The type of the Load Balancer.
“Load Balancing”
resourceMetrics
Field
Type
Description
Example Value
totalELBRequestCount
float
Indicates the total number of HTTP or HTTPS requests received by the Elastic Load Balancer within the scan timeframe.
0
Scans: Elastic IP - Idle
Metadata
Field
Type
Description
Example Value
accountId
string
The account ID of the resource.
“1234”
accountName
string
The account of the resource.
"finout"
region
string
The region of the account.
“us-east-1”
resourceMetrics
Field
Type
Description
Example Value
totalIdleHours
float
The total hours of idle Elastic IPs during the analysis period.
722
Scans: elasticache - Idle
Metadata
Field
Type
Description
Example Value
accountId
string
The account IDof the resource.
“1234”
accountName
string
The account of the resource.
"finout"
instanceType
string
The size of the instance.
“cache.m5.large
resourceMetrics
Field
Type
Description
Example Value
maxElastiCacheCpuUtilization
float
CPU utilization percentage represents the peak CPU usage within the scan analysisDays. This value is determined by identifying the highest recorded CPU usage during the specified period and is expressed as a percentage of the total CPU capacity.
“1.21”
Scans: S3 - Idle
Metadata
Field
Type
Description
Example Value
accountId
string
The account IDof the resource.
“1234”
accountName
string
Account of the resource.
"finout"
instanceType
string
The size of the instance.
“cache.m5.large
resourceMetrics
Field
Type
Description
Example Value
s3AllRequests
float
Represents the total number of requests sent to an S3 bucket. For an idle bucket, the expected result would be 0, indicating no requests have been made.
“0”
K8S
Scans: K8s - Deployment/StatefulSet/CronJob/DaemonSet/ReplicaSet
resourceMetadata
Field
Type
Description
Example Value
cloudOrigin
string
The cloud platform where the Kubernetes resources are running.
“amazon-cur”
resourceMetrics
Field
Type
Description
Example Value
maxCpuUsage
float
Resource maximum CPU used during the analysis days.
0.064450918833
maxCpuRequest
float
Resource maximum CPU request during the analysis time frame.
1
avgCpuUsage
float
Resource average CPU used during the analysis time frame.
0.00067
avgCpuRequest
float
Resource average CPU request during the analysis time frame.
1
maxMemoryUsage
float
Resource maximum memory used during the analysis time frame.
521.361
maxMemoryRequest
float
Resource maximum meme request during the analysis time frame.
12980
avgMemoryUsage
Resource average mem used during the analysis days.
322
avgMemoryRequest
Resources average mem request during the analysis time frame.
12980
Datadog
Scans: Logs - Idle (debug)
Metadata
Field
Type
Description
Example Value
product
string
Datadog service
“Logs indexed 3day”
service
string
Datadog tag: service
“Internal service”
datadogIndex
string
Datadog tag: index
“production”
status
string
The status of the log is "debug," and is therefore considered idle.
“debug”
Scans: Custom Metrics - Idle
Metadata
Field
Type
Description
Example Value
product
string
Datadog sub service.
“Timeseries”
wasteType
string
Custom metrics that are not being used in any dashboards.
“idle”
GCP
VM - Idle
resourceMetadata
Field
Type
Description
Example Value
projectId
string
The project ID of the resource.
“1234”
projectName
string
Project of the resource.
"finout"
computeMachineSpec
string
Current machine type.
“n1-standard-4”
computeCores
number
Number of cores on the machine.
6
computeMemory
number
Amount of Memory configured to the machine (In MegaBytes).
30720
resourceMetrics
Field
Type
Description
Example Value
maxComputeCpuUtilization
float
The maximum CPU usage during the analysis days.
“1.235593220338884”
avgBytesReceived
float
Average amounts of data received daily by the resource (in bytes) during the analysis timeframe.
889167
avgBytesSent
float
Average amounts of data sent daily by the resource (in bytes) during the analysis time frame.
889167
VM - Rightsizing
resourceMetadata
Field
Type
Description
Example Value
projectId
string
The project ID of the resource.
“1234”
projectName
string
Project of the resource.
"finout"
computeMachineSpec
string
Current machine type.
“n1-standard-4”
computeCores
number
Number of cores on the machine.
“6”
computeMemory
number
Amount of Memory configured to the machine (In MegaBytes).
30720
resourceMetrics
Field
Type
Description
Example Value
maxComputeCpuUtilization
float
Maximum CPU usage during the analysis days (in %).
“4.0”
resourceRecommendations
Field
Type
Description
Example Value
targetMachineSpec
String
The recommended machine type for rightsizing.
“custom-32-262144”
targetMemory
number
Target of the memory (In GigaBytes).
512
targetCpu
number
Target of the CPU.
2
Snapshot - Idle
Metadata
Field
Type
Description
Example Value
projectId
string
The project ID of the resource.
“1234”
projectName
string
The project of the resource.
"finout"
Scans: Persistent Disk - Idle
Metadata
Field
Type
Description
Example Value
projectId
string
The project ID of the resource.
“1234”
projectName
string
Project of the resource.
"finout"
SQL - Idle
resourceMetadata
Field
Type
Description
Example Value
projectId
string
The project ID of the resource.
“1234”
projectName
string
Project of the resource.
"finout"
instanceType
string
The size of the instance.
“t2.medium”
resourceMetrics
Field
Type
Description
Example Value
maxSqlCpuUtilization
float
CPU utilization percentage represents the peak CPU usage within the scan analysisDays. This value is determined by identifying the highest recorded CPU usage during the specified period, expressed as a percentage of the total CPU capacity
“1.21”
maxSqlMemoryUtilization
float
The maximum memory used during the scan analysisDays (In GigaBytes).
“4.2”
Last updated