Skip to content

Commit a13e30c

Browse files
committed
fix instance-types filter and update readmes
1 parent 49a955b commit a13e30c

File tree

6 files changed

+113
-105
lines changed

6 files changed

+113
-105
lines changed

.github/workflows/ci.yaml

+14-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: EC2 Instance Selector CI and Release
33
on: [push, pull_request, workflow_dispatch]
44

55
env:
6-
DEFAULT_GO_VERSION: ^1.23
76
GITHUB_USERNAME: ${{ secrets.EC2_BOT_GITHUB_USERNAME }}
87
GITHUB_TOKEN: ${{ secrets.EC2_BOT_GITHUB_TOKEN }}
98
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -16,13 +15,15 @@ jobs:
1615
name: Build and Test
1716
runs-on: ubuntu-20.04
1817
steps:
18+
- name: Check out code into the Go module directory
19+
uses: actions/checkout@v4
20+
1921
- name: Set up Go 1.x
20-
uses: actions/setup-go@v2
22+
uses: actions/setup-go@v5
2123
with:
22-
go-version: ${{ env.DEFAULT_GO_VERSION }}
23-
24-
- name: Check out code into the Go module directory
25-
uses: actions/checkout@v3
24+
go-version-file: 'go.mod'
25+
check-latest: true
26+
cache-dependency-path: '**/go.sum'
2627

2728
- name: Unit Tests
2829
run: make unit-test
@@ -57,13 +58,15 @@ jobs:
5758
needs: [buildAndTest]
5859
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
5960
steps:
61+
- name: Check out code into the Go module directory
62+
uses: actions/checkout@v4
63+
6064
- name: Set up Go 1.x
61-
uses: actions/setup-go@v2
65+
uses: actions/setup-go@v5
6266
with:
63-
go-version: ${{ env.DEFAULT_GO_VERSION }}
64-
65-
- name: Check out code into the Go module directory
66-
uses: actions/checkout@v2
67+
go-version-file: 'go.mod'
68+
check-latest: true
69+
cache-dependency-path: '**/go.sum'
6770

6871
- name: Release Assets
6972
run: make release

README.md

+32-31
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ c6gn.16xlarge
106106
c6in.16xlarge
107107
c7gn.8xlarge
108108
dl1.24xlarge
109+
f2.48xlarge
109110
g4dn.metal
110111
g5.48xlarge
111112
g6.48xlarge
112113
g6e.12xlarge
113114
i3en.24xlarge
114115
i3en.metal
116+
i7ie.24xlarge
117+
i7ie.48xlarge
115118
im4gn.16xlarge
116119
inf1.24xlarge
117120
inf2.48xlarge
118121
m5dn.24xlarge
119122
m5dn.metal
120-
m5n.24xlarge
121-
m5n.metal
122-
m5zn.12xlarge
123-
NOTE: 19 entries were truncated, increase --max-results to see more
123+
NOTE: 22 entries were truncated, increase --max-results to see more
124124
```
125125

126126
**Short Table Output**
@@ -149,20 +149,20 @@ t3a.medium 2 4
149149
$ ec2-instance-selector --memory 4 --vcpus 2 --cpu-architecture x86_64 -r us-east-1 -o table-wide
150150
Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr
151151
------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ -------------
152-
c5.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.085 $0.0405
153-
c5a.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none $0.077 $0.0308
154-
c5ad.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none $0.086 $0.0415
155-
c5d.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.096 $0.0281
156-
c6a.large 2 4 nitro true false x86_64 Up to 12.5 Gigabit 3 0 0 none $0.0765 $0.0285
157-
c6i.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.085 $0.0292
158-
c6id.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.1008 $0.0391
159-
c6in.large 2 4 nitro true false x86_64 Up to 25 Gigabit 3 0 0 none $0.1134 $0.0403
160-
c7a.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.10264 $0.0457
161-
c7i-flex.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.08479 $0.022
162-
c7i.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.08925 $0.0359
163-
t2.medium 2 4 xen true true i386, x86_64 Low to Moderate 3 0 0 none $0.0464 $0.0156
164-
t3.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0416 $0.015
165-
t3a.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0376 $0.0106
152+
c5.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.085 $0.0264
153+
c5a.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none $0.077 $0.025
154+
c5ad.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none $0.086 $0.0358
155+
c5d.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.096 $0.036
156+
c6a.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.0765 $0.0252
157+
c6i.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.085 $0.0252
158+
c6id.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.1008 $0.0359
159+
c6in.large 2 4 nitro true true x86_64 Up to 25 Gigabit 3 0 0 none $0.1134 $0.043
160+
c7a.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.10264 $0.0429
161+
c7i-flex.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.08479 $0.0245
162+
c7i.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.08925 $0.0367
163+
t2.medium 2 4 xen true true i386, x86_64 Low to Moderate 3 0 0 none $0.0464 $0.0135
164+
t3.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0416 $0.016
165+
t3a.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0376 $0.0108
166166
```
167167

168168
**Interactive Output**
@@ -176,17 +176,17 @@ https://user-images.githubusercontent.com/68402662/184218343-6b236d4a-3fe6-42ae-
176176
$ ec2-instance-selector -r us-east-1 -o table-wide --max-results 10 --sort-by memory --sort-direction asc
177177
Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr
178178
------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ -------------
179-
t3a.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0047 $0.0018
180179
t2.nano 1 0.5 xen true true i386, x86_64 Low to Moderate 2 0 0 none $0.0058 -Not Fetched-
181-
t4g.nano 2 0.5 nitro true true arm64 Up to 5 Gigabit 2 0 0 none $0.0042 $0.0018
182-
t3.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0052 $0.0006
183-
t1.micro 1 0.6123 xen false false i386, x86_64 Very Low 2 0 0 none $0.02 $0.0021
184-
t3.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0104 $0.0029
185-
t2.micro 1 1 xen true true i386, x86_64 Low to Moderate 2 0 0 none $0.0116 $0.0016
186-
t4g.micro 2 1 nitro true true arm64 Up to 5 Gigabit 2 0 0 none $0.0084 $0.0024
187-
t3a.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0094 $0.0031
188-
m1.small 1 1.69922 xen false false i386, x86_64 Low 2 0 0 none $0.044 $0.0048
189-
NOTE: 832 entries were truncated, increase --max-results to see more
180+
t4g.nano 2 0.5 nitro true true arm64 Up to 5 Gigabit 2 0 0 none $0.0042 $0.0011
181+
t3.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0052 $0.0011
182+
t3a.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0047 $0.0022
183+
t1.micro 1 0.6123 xen false false i386, x86_64 Very Low 2 0 0 none $0.02 $0.0024
184+
t2.micro 1 1 xen true true i386, x86_64 Low to Moderate 2 0 0 none $0.0116 $0.0029
185+
t3a.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0094 $0.0033
186+
t4g.micro 2 1 nitro true true arm64 Up to 5 Gigabit 2 0 0 none $0.0084 $0.0046
187+
t3.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0104 $0.0028
188+
m1.small 1 1.69922 xen false false i386, x86_64 Low 2 0 0 none $0.044 $0.0115
189+
NOTE: 855 entries were truncated, increase --max-results to see more
190190
```
191191
Available shorthand flags: vcpus, memory, gpu-memory-total, network-interfaces, spot-price, on-demand-price, instance-storage, ebs-optimized-baseline-bandwidth, ebs-optimized-baseline-throughput, ebs-optimized-baseline-iops, gpus, inference-accelerators
192192

@@ -203,9 +203,9 @@ u7in-16tb.224xlarge 896 16,384 nitro true false
203203
u7i-12tb.224xlarge 896 12,288 nitro true false x86_64 100 Gigabit 15 0 0 none $152.88 -Not Fetched-
204204
u-12tb1.112xlarge 448 12,288 nitro true false x86_64 100 Gigabit 15 0 0 none $109.2 -Not Fetched-
205205
u-9tb1.112xlarge 448 9,216 nitro true false x86_64 100 Gigabit 15 0 0 none $81.9 -Not Fetched-
206+
u7i-8tb.112xlarge 448 8,192 nitro true false x86_64 100 Gigabit 15 0 0 none $83.72 -Not Fetched-
206207
u-6tb1.56xlarge 224 6,144 nitro true false x86_64 100 Gigabit 15 0 0 none $46.40391 -Not Fetched-
207-
u-6tb1.112xlarge 448 6,144 nitro true false x86_64 100 Gigabit 15 0 0 none $54.6 -Not Fetched-
208-
NOTE: 832 entries were truncated, increase --max-results to see more
208+
NOTE: 855 entries were truncated, increase --max-results to see more
209209
```
210210
JSON path must point to a field in the [instancetype.Details struct](https://github.com/aws/amazon-ec2-instance-selector/blob/5bffbf2750ee09f5f1308bdc8d4b635a2c6e2721/pkg/instancetypes/instancetypes.go#L37).
211211

@@ -367,7 +367,7 @@ NOTE: There were no transformations on the filters to display
367367
"SpotPrice": null
368368
}
369369
]
370-
NOTE: 841 entries were truncated, increase --max-results to see more
370+
NOTE: 864 entries were truncated, increase --max-results to see more
371371
```
372372
NOTE: Use this JSON format as reference when finding JSON paths for sorting
373373

@@ -437,6 +437,7 @@ Filter Flags:
437437
--instance-storage string Amount of local instance storage (Example: 4 GiB) (sets --instance-storage-min and -max to the same value)
438438
--instance-storage-max string Maximum Amount of local instance storage (Example: 4 GiB) If --instance-storage-min is not specified, the lower bound will be 0
439439
--instance-storage-min string Minimum Amount of local instance storage (Example: 4 GiB) If --instance-storage-max is not specified, the upper bound will be infinity
440+
--instance-types strings Instance Type names (must be exact, use allow-list for regex)
440441
--ipv6 Instance Types that support IPv6
441442
-m, --memory string Amount of Memory available (Example: 4 GiB) (sets --memory-min and -max to the same value)
442443
--memory-max string Maximum Amount of Memory available (Example: 4 GiB) If --memory-min is not specified, the lower bound will be 0

cmd/main.go

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const (
104104
dedicatedHosts = "dedicated-hosts"
105105
debug = "debug"
106106
generation = "generation"
107+
instanceTypes = "instance-types"
107108
)
108109

109110
// Aggregate Filter Flags.
@@ -208,6 +209,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
208209
cli.BoolFlag(autoRecovery, nil, nil, "EC2 Auto-Recovery supported")
209210
cli.BoolFlag(dedicatedHosts, nil, nil, "Dedicated Hosts supported")
210211
cli.IntMinMaxRangeFlags(generation, nil, nil, "Generation of the instance type (i.e. c7i.xlarge is 7)")
212+
cli.StringSliceFlag(instanceTypes, nil, nil, "Instance Type names (must be exact, use allow-list for regex)")
211213

212214
// Suite Flags - higher level aggregate filters that return opinionated result
213215

@@ -425,6 +427,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
425427
AutoRecovery: cli.BoolMe(flags[autoRecovery]),
426428
DedicatedHosts: cli.BoolMe(flags[dedicatedHosts]),
427429
Generation: cli.IntRangeMe(flags[generation]),
430+
InstanceTypes: cli.StringSliceMe(flags[instanceTypes]),
428431
}
429432

430433
if flags[verbose] != nil {

go.mod

+21-21
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ go 1.23
44

55
require (
66
dario.cat/mergo v1.0.1
7-
github.com/aws/aws-sdk-go-v2 v1.32.6
8-
github.com/aws/aws-sdk-go-v2/config v1.28.0
9-
github.com/aws/aws-sdk-go-v2/service/ec2 v1.186.0
10-
github.com/aws/aws-sdk-go-v2/service/pricing v1.32.7
7+
github.com/aws/aws-sdk-go-v2 v1.36.1
8+
github.com/aws/aws-sdk-go-v2/config v1.29.6
9+
github.com/aws/aws-sdk-go-v2/service/ec2 v1.203.0
10+
github.com/aws/aws-sdk-go-v2/service/pricing v1.32.16
1111
github.com/blang/semver/v4 v4.0.0
1212
github.com/charmbracelet/bubbles v0.20.0
13-
github.com/charmbracelet/bubbletea v1.2.4
13+
github.com/charmbracelet/bubbletea v1.3.3
1414
github.com/charmbracelet/lipgloss v1.0.0
1515
github.com/evertras/bubble-table v0.17.1
1616
github.com/mitchellh/go-homedir v1.1.0
@@ -19,25 +19,25 @@ require (
1919
github.com/patrickmn/go-cache v2.1.0+incompatible
2020
github.com/samber/lo v1.47.0
2121
github.com/spf13/cobra v1.8.1
22-
github.com/spf13/pflag v1.0.5
22+
github.com/spf13/pflag v1.0.6
2323
go.uber.org/multierr v1.11.0
2424
)
2525

2626
require (
2727
github.com/atotto/clipboard v0.1.4 // indirect
28-
github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect
29-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect
30-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.25 // indirect
31-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.25 // indirect
32-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
33-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
34-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect
35-
github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect
36-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect
37-
github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect
38-
github.com/aws/smithy-go v1.22.1 // indirect
28+
github.com/aws/aws-sdk-go-v2/credentials v1.17.59 // indirect
29+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.28 // indirect
30+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.32 // indirect
31+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.32 // indirect
32+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2 // indirect
34+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.13 // indirect
35+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.15 // indirect
36+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14 // indirect
37+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 // indirect
38+
github.com/aws/smithy-go v1.22.2 // indirect
3939
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
40-
github.com/charmbracelet/x/ansi v0.4.5 // indirect
40+
github.com/charmbracelet/x/ansi v0.8.0 // indirect
4141
github.com/charmbracelet/x/term v0.2.1 // indirect
4242
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
4343
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -50,7 +50,7 @@ require (
5050
github.com/muesli/reflow v0.3.0 // indirect
5151
github.com/rivo/uniseg v0.4.7 // indirect
5252
github.com/sahilm/fuzzy v0.1.1 // indirect
53-
golang.org/x/sync v0.9.0 // indirect
54-
golang.org/x/sys v0.27.0 // indirect
55-
golang.org/x/text v0.16.0 // indirect
53+
golang.org/x/sync v0.11.0 // indirect
54+
golang.org/x/sys v0.30.0 // indirect
55+
golang.org/x/text v0.22.0 // indirect
5656
)

0 commit comments

Comments
 (0)