1.1.50 • Published 12 months ago

aws-spot-price v1.1.50

Weekly downloads
73
License
MIT
Repository
github
Last release
12 months 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"
--architectures | -a

Instance architecture types to filter. Accepts multiple string values.

Default: "arm64","arm64_mac","i386","x86_64","x86_64_mac"
example -a arm64 x86_64
--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,
    architectures: ['arm64', 'x86_64']
  });
  console.log(JSON.stringify(results, null, 2));
})();

Results

[
  {
    "availabilityZone": "us-east-2c",
    "instanceType": "t4g.medium",
    "platform": "Linux/UNIX",
    "architectures": [
      "arm64"
    ],
    "spotPrice": 0.0083,
    "timestamp": "2024-05-16T10:31:10.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  },
  {
    "availabilityZone": "us-west-2a",
    "instanceType": "c7a.large",
    "platform": "Linux/UNIX",
    "architectures": [
      "x86_64"
    ],
    "spotPrice": 0.0103,
    "timestamp": "2024-05-15T16:09:23.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  },
  {
    "availabilityZone": "us-west-1b",
    "instanceType": "c7i-flex.large",
    "platform": "Linux/UNIX",
    "architectures": [
      "x86_64"
    ],
    "spotPrice": 0.0108,
    "timestamp": "2024-05-16T04:16:55.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  },
  {
    "availabilityZone": "us-west-2d",
    "instanceType": "m7a.large",
    "platform": "Linux/UNIX",
    "architectures": [
      "x86_64"
    ],
    "spotPrice": 0.0117,
    "timestamp": "2024-05-16T00:47:33.000Z",
    "vCpu": 2,
    "memoryGiB": 8
  },
  {
    "availabilityZone": "us-west-2b",
    "instanceType": "t3a.medium",
    "platform": "Linux/UNIX",
    "architectures": [
      "x86_64"
    ],
    "spotPrice": 0.0129,
    "timestamp": "2024-05-16T09:02:05.000Z",
    "vCpu": 2,
    "memoryGiB": 4
  }
]
1.1.49

12 months ago

1.1.50

12 months ago

1.1.48

12 months ago

1.1.47

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.46

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.38

1 year ago

1.1.39

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.30

1 year ago

1.1.32

1 year ago

1.1.31

1 year ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.10

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

1.0.102

2 years ago

1.0.101

2 years ago

1.0.100

2 years ago

1.0.99

2 years ago

1.0.98

2 years ago

1.0.97

2 years ago

1.0.96

2 years ago

1.0.95

2 years ago

1.0.94

2 years ago

1.0.93

2 years ago

1.0.92

2 years ago

1.0.91

2 years ago

1.0.90

2 years ago

1.0.88

2 years ago

1.0.89

2 years ago

1.0.87

2 years ago

1.0.77

3 years ago

1.0.76

3 years ago

1.0.75

3 years ago

1.0.74

3 years ago

1.0.79

2 years ago

1.0.78

2 years ago

1.0.80

2 years ago

1.0.84

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.81

2 years ago

1.0.86

2 years ago

1.0.85

2 years ago

1.0.73

3 years ago

1.0.72

3 years ago

1.0.71

3 years ago

1.0.70

3 years ago

1.0.69

3 years ago

1.0.66

3 years ago

1.0.65

3 years ago

1.0.64

3 years ago

1.0.68

3 years ago

1.0.67

3 years ago

1.0.62

3 years ago

1.0.61

3 years ago

1.0.63

3 years ago

1.0.60

3 years ago

1.0.55

3 years ago

1.0.54

3 years ago

1.0.53

3 years ago

1.0.52

3 years ago

1.0.59

3 years ago

1.0.58

3 years ago

1.0.57

3 years ago

1.0.56

3 years ago

1.0.51

3 years ago

1.0.48

4 years ago

1.0.49

4 years ago

1.0.50

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.41

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.40

4 years ago

1.0.37

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.6.0

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1-beta

6 years ago

0.0.1

6 years ago