Skip to content

Commit d8ca58f

Browse files
authored
fix instance-types filter and update readmes (#411)
* fix instance-types filter and update readmes * case insensitive selector evaluation for strings
1 parent 49a955b commit d8ca58f

File tree

10 files changed

+146
-139
lines changed

10 files changed

+146
-139
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

.github/workflows/golangci-lint.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
- uses: actions/checkout@v4
1818
- uses: actions/setup-go@v5
1919
with:
20-
go-version: stable
20+
go-version-file: 'go.mod'
21+
check-latest: true
22+
cache-dependency-path: '**/go.sum'
2123
- name: golangci-lint
22-
uses: golangci/golangci-lint-action@v6
23-
with:
24-
version: v1.60
24+
uses: golangci/golangci-lint-action@v6

README.md

+34-33
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

@@ -395,8 +395,8 @@ Filter Flags:
395395
-z, --availability-zones strings Availability zones or zone ids to check EC2 capacity offered in specific AZs
396396
--baremetal Bare Metal instance types (.metal instances)
397397
-b, --burst-support Burstable instance types
398-
-a, --cpu-architecture string CPU architecture [x86_64, amd64, x86_64_mac, i386, or arm64]
399-
--cpu-manufacturer string CPU manufacturer [amd, intel, aws]
398+
-a, --cpu-architecture string CPU architecture [x86_64, amd64, x86_64_mac, i386, arm64, or arm64_mac]
399+
--cpu-manufacturer string CPU manufacturer [amd, intel, aws, apple]
400400
--current-generation Current generation instance types (explicitly set this to false to not return current generation instance types)
401401
--dedicated-hosts Dedicated Hosts supported
402402
--deny-list string List of instance types which should be excluded w/ regex syntax (Example: m[1-2]\.*)
@@ -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

+5-2
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.
@@ -167,8 +168,8 @@ Full docs can be found at github.com/aws/amazon-` + binName
167168
cli.Int32MinMaxRangeFlags(vcpus, cli.StringMe("c"), nil, "Number of vcpus available to the instance type.")
168169
cli.ByteQuantityMinMaxRangeFlags(memory, cli.StringMe("m"), nil, "Amount of Memory available (Example: 4 GiB)")
169170
cli.RatioFlag(vcpusToMemoryRatio, nil, nil, "The ratio of vcpus to GiBs of memory. (Example: 1:2)")
170-
cli.StringOptionsFlag(cpuArchitecture, cli.StringMe("a"), nil, "CPU architecture [x86_64, amd64, x86_64_mac, i386, or arm64]", []string{"x86_64", "x86_64_mac", "amd64", "i386", "arm64"})
171-
cli.StringOptionsFlag(cpuManufacturer, nil, nil, "CPU manufacturer [amd, intel, aws]", []string{"amd", "intel", "aws"})
171+
cli.StringOptionsFlag(cpuArchitecture, cli.StringMe("a"), nil, "CPU architecture [x86_64, amd64, x86_64_mac, i386, arm64, or arm64_mac]", []string{"x86_64", "x86_64_mac", "amd64", "i386", "arm64", "arm64_mac"})
172+
cli.StringOptionsFlag(cpuManufacturer, nil, nil, "CPU manufacturer [amd, intel, aws, apple]", []string{"amd", "intel", "aws", "apple"})
172173
cli.Int32MinMaxRangeFlags(gpus, cli.StringMe("g"), nil, "Total Number of GPUs (Example: 4)")
173174
cli.ByteQuantityMinMaxRangeFlags(gpuMemoryTotal, nil, nil, "Number of GPUs' total memory (Example: 4 GiB)")
174175
cli.StringFlag(gpuManufacturer, nil, nil, "GPU Manufacturer name (Example: NVIDIA)", nil)
@@ -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 {

0 commit comments

Comments
 (0)