aws-spot-price
Version:
CLI utility to list current global AWS EC2 Spot Instance prices.
59 lines (58 loc) • 2.17 kB
TypeScript
import { ArchitectureType } from '@aws-sdk/client-ec2';
import { Ec2InstanceInfo } from '../constants/ec2-info';
import { InstanceFamilyType, InstanceSize, InstanceType } from '../constants/ec2-types';
import { Platform } from '../constants/platform';
import { Region } from '../constants/regions';
export declare class Ec2SpotPriceError extends Error {
constructor(message: string, region: Region, code: string);
readonly ec2SpotPriceError = true;
static isEc2SpotPriceError(error: any): error is Ec2SpotPriceError;
readonly region: Region;
readonly code: string;
}
/** `ExceptionType` should be extended from '@aws-sdk/smithy-client', but removed due to ts types packaging reasons */
export declare const isAWSError: <ExceptionType>(error: any) => error is ExceptionType;
type Ec2InstanceInfos = Record<InstanceType | string, Ec2InstanceInfo>;
export declare const getEc2Info: ({ region, InstanceTypes, log, accessKeyId, secretAccessKey, }?: {
region?: string;
InstanceTypes?: (InstanceType | string)[];
log?: boolean;
accessKeyId?: string;
secretAccessKey?: string;
}) => Promise<Ec2InstanceInfos>;
export declare const defaults: {
limit: number;
wide: boolean;
reduceAZ: boolean;
platforms: Platform[];
architectures: ArchitectureType[];
minVCPU: number;
minMemoryGiB: number;
priceLimit: number;
};
export type SpotPriceExtended = {
availabilityZone: string;
instanceType: string;
platform: string;
spotPrice: number;
timestamp: Date;
} & Ec2InstanceInfo;
export declare const getGlobalSpotPrices: (options?: {
regions?: Region[];
familyTypes?: InstanceFamilyType[];
sizes?: InstanceSize[];
priceLimit?: number;
minVCPU?: number;
minMemoryGiB?: number;
instanceTypes?: InstanceType[];
platforms?: Platform[];
architectures?: ArchitectureType[];
limit?: number;
reduceAZ?: boolean;
accessKeyId?: string;
secretAccessKey?: string;
onRegionFetch?: (region: Region) => void;
onRegionFetchFail?: (error: Ec2SpotPriceError) => void;
onFetchComplete?: () => void;
}) => Promise<SpotPriceExtended[]>;
export {};