UNPKG

@cloud-carbon-footprint/aws

Version:

The core logic to get cloud usage data and estimate energy and carbon emissions from Amazon Web Services.

21 lines (20 loc) 983 B
import { CostExplorer } from 'aws-sdk'; import { StorageUsage, FootprintEstimate, CloudConstants, CloudConstantsEmissionsFactors } from '@cloud-carbon-footprint/core'; import { ServiceWrapper } from './ServiceWrapper'; export declare class VolumeUsage implements StorageUsage { readonly terabyteHours: number; readonly timestamp: Date; readonly diskType: DiskType; } export interface MutableFootprintEstimate { timestamp: Date; co2e: number; kilowattHours: number; } export declare enum DiskType { SSD = "SSD", HDD = "HDD", UNKNOWN = "UNKNOWN" } export declare function getUsageFromCostExplorer(params: CostExplorer.GetCostAndUsageRequest, diskTypeCallBack: (awsGroupKey: string) => DiskType, serviceWrapper: ServiceWrapper): Promise<VolumeUsage[]>; export declare function getEstimatesFromCostExplorer(region: string, volumeUsages: VolumeUsage[], emissionsFactors: CloudConstantsEmissionsFactors, constants: CloudConstants): FootprintEstimate[];