1.0.96 • Published 21 days ago

aws-spot-price v1.0.96

Weekly downloads
73
License
MIT
Repository
github
Last release
21 days ago

aws-spot-price

npm:latest

Build Status Quality Gate Status Coverage

Lists current global AWS EC2 Spot Instance prices.

Supports CLI and module usage.

CLI

Example

Example

Installation

npm

npm i aws-spot-price

yarn

yarn add aws-spot-price

run with npx

npx aws-spot-price

run with yarn dlx

yarn dlx aws-spot-price

Usage

aws-spot-run [options]

If no options are applied, it will fetch all recent pricing data from default regions and show top 30 cheapest instances.

Credentials

This CLI utility uses AWS-SDK and requires AWS Access & Secret keys. If environment variables pair AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY or ~/.aws/credentials is available it will use it. Otherwise, you will need to supply credentials through CLI options --accessKeyId and --secretAccessKey.

Permissions Required
  • ec2:DescribeSpotPriceHistory
  • ec2:DescribeInstanceTypes

Options

--ui

Start with UI mode.

--region | -r

AWS region to fetch data from. Accepts multiple string values. Defaults to all available AWS region which does not require opt-in.

example -r us-east-1 us-east-2
--family

EC2 instance families to filter. Will be translated to --familyType and --size values. Accepts multiple string values. Choose from: general, compute, memory, storage, acceleratedComputing

example -f general compute
--instanceType | -i

Type of EC2 instance to filter. Accepts multiple string values. Enter valid EC2 instance type name.

example -i t3.nano t3a.nano
--familyType | -f

EC2 Family type (c4, c5, etc..). Accepts multiple string values.

example -f c4 c5
--size | -s

EC2 size (large, xlarge, etc..). Accepts multiple string values.

example -s large xlarge
--minVCPU | --mc

Minimum vCPU count

Default: 1
--minMemoryGiB | --mm

Minimum memory size in GiB

Default: 0.5
--priceLimit | --pl

Maximum price limit.

Default: 100
--platforms | -p

Instance platforms types to filter. Accepts multiple string values. You can use linux or windows (all in lowercase) as wildcard.

Default: "Linux/UNIX" "Linux/UNIX (Amazon VPC)"
example -p windows "Red Hat Enterprise Linux"
--limit | -l

Limits list of price information items to be returned.

Default: 30
--reduceAZ | --raz

Reduce results with cheapest Availability Zone within Region

Default: true
--wide | -w

Output results with detail (vCPU, memory, etc)

Default: false
--json | -j

Outputs in JSON format. This option will silence any progress output.

--accessKeyId

Specific AWS Access Key ID. Requires --secretAccessKey option to be used together.

--secretAccessKey

Specific AWS Secret Access Key. Requires --accessKeyId option to be used together.

Module

Installation

npm

npm i aws-spot-price

yarn

yarn add aws-spot-price

Example

Code

import { getGlobalSpotPrices } from 'aws-spot-price';

(async () => {
  const results = await getGlobalSpotPrices({
    regions: ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2'],
    familyTypes: ['c5', 'c5a', 'c5ad', 'c5d', 'c5n', 'c6g', 'c6gd'],
    minMemoryGiB: 4,
    minVCPU: 2,
    limit: 5,
    reduceAZ: true,
  });
  console.log(JSON.stringify(results, null, 2));
})();

Results

  {
    "availabilityZone": "us-east-2c",
    "instanceType": "c5.large",
    "platform": "Linux/UNIX",
    "spotPrice": 0.019,
    "timestamp": "2020-11-19T15:18:07.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  },
  {
    "availabilityZone": "us-east-2c",
    "instanceType": "c5a.large",
    "platform": "Linux/UNIX",
    "spotPrice": 0.019,
    "timestamp": "2020-11-19T22:04:26.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  },
  {
    "availabilityZone": "us-east-2a",
    "instanceType": "c5d.large",
    "platform": "Linux/UNIX",
    "spotPrice": 0.019,
    "timestamp": "2020-11-19T05:58:45.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  },
  {
    "availabilityZone": "us-east-2a",
    "instanceType": "c5n.large",
    "platform": "Linux/UNIX",
    "spotPrice": 0.019,
    "timestamp": "2020-11-20T02:27:24.000Z",
    "vCpu": 2,
    "memoryGiB": 5.25
  },
  {
    "availabilityZone": "us-east-2b",
    "instanceType": "c6g.large",
    "platform": "Linux/UNIX",
    "spotPrice": 0.02,
    "timestamp": "2020-11-19T13:41:03.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  }
]
1.0.96

21 days ago

1.0.95

1 month ago

1.0.94

1 month ago

1.0.93

3 months ago

1.0.92

3 months ago

1.0.91

4 months ago

1.0.90

5 months ago

1.0.88

5 months ago

1.0.89

5 months ago

1.0.87

5 months ago

1.0.77

9 months ago

1.0.76

9 months ago

1.0.75

9 months ago

1.0.74

9 months ago

1.0.79

7 months ago

1.0.78

7 months ago

1.0.80

6 months ago

1.0.84

5 months ago

1.0.83

6 months ago

1.0.82

6 months ago

1.0.81

6 months ago

1.0.86

5 months ago

1.0.85

5 months ago

1.0.73

10 months ago

1.0.72

10 months ago

1.0.71

11 months ago

1.0.70

12 months ago

1.0.69

1 year ago

1.0.66

1 year ago

1.0.65

1 year ago

1.0.64

1 year ago

1.0.68

1 year ago

1.0.67

1 year ago

1.0.62

1 year ago

1.0.61

1 year ago

1.0.63

1 year ago

1.0.60

1 year ago

1.0.55

1 year ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.59

1 year ago

1.0.58

1 year ago

1.0.57

1 year ago

1.0.56

1 year ago

1.0.51

2 years ago

1.0.48

2 years ago

1.0.49

2 years ago

1.0.50

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.40

2 years ago

1.0.37

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.6.0

3 years ago

0.5.9

3 years ago

0.5.8

4 years ago

0.5.7

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1-beta

5 years ago

0.0.1

5 years ago