Skip to content

Commit 57972ce

Browse files
committed
fix instance-types filter and update readmes
1 parent 62ddeb2 commit 57972ce

File tree

8 files changed

+55
-48
lines changed

8 files changed

+55
-48
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 11 deletions
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

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 as builder
1+
FROM golang:1.24 as builder
22

33
## GOLANG env
44
ARG GOPROXY="https://proxy.golang.org|direct"

README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h4>A CLI tool and go library which recommends instance types based on resource criteria like vcpus and memory.</h4>
44

55
<p>
6-
<a href="https://golang.org/doc/go1.23">
6+
<a href="https://golang.org/doc/go1.24">
77
<img src="https://img.shields.io/github/go-mod/go-version/aws/amazon-ec2-instance-selector?color=blueviolet" alt="go-version">
88
</a>
99
<a href="https://opensource.org/licenses/Apache-2.0">
@@ -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

Lines changed: 3 additions & 0 deletions
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
@@ -211,6 +212,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
211212
cli.BoolFlag(autoRecovery, nil, nil, "EC2 Auto-Recovery supported")
212213
cli.BoolFlag(dedicatedHosts, nil, nil, "Dedicated Hosts supported")
213214
cli.IntMinMaxRangeFlags(generation, nil, nil, "Generation of the instance type (i.e. c7i.xlarge is 7)")
215+
cli.StringSliceFlag(instanceTypes, nil, nil, "Instance Type names (must be exact, use allow-list for regex)")
214216

215217
// Suite Flags - higher level aggregate filters that return opinionated result
216218

@@ -428,6 +430,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
428430
AutoRecovery: cli.BoolMe(flags[autoRecovery]),
429431
DedicatedHosts: cli.BoolMe(flags[dedicatedHosts]),
430432
Generation: cli.IntRangeMe(flags[generation]),
433+
InstanceTypes: cli.StringSliceMe(flags[instanceTypes]),
431434
}
432435

433436
if flags[verbose] != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/aws/amazon-ec2-instance-selector/v3
22

3-
go 1.23
3+
go 1.24
44

55
require (
66
dario.cat/mergo v1.0.1

pkg/selector/selector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func (s Selector) prepareFilter(ctx context.Context, filters Filters, instanceTy
326326
networkPerformance: {filters.NetworkPerformance, getNetworkPerformance(instanceTypeInfo.NetworkInfo.NetworkPerformance)},
327327
networkEncryption: {filters.NetworkEncryption, instanceTypeInfo.NetworkInfo.EncryptionInTransitSupported},
328328
ipv6: {filters.IPv6, instanceTypeInfo.NetworkInfo.Ipv6Supported},
329-
instanceTypes: {filters.InstanceTypes, instanceTypeInfo.InstanceType},
329+
instanceTypes: {filters.InstanceTypes, aws.String(string(instanceTypeInfo.InstanceType))},
330330
virtualizationType: {filters.VirtualizationType, instanceTypeInfo.SupportedVirtualizationTypes},
331331
pricePerHour: {filters.PricePerHour, &instanceTypeHourlyPriceForFilter},
332332
instanceStorageRange: {filters.InstanceStorageRange, getInstanceStorage(instanceTypeInfo.InstanceStorageInfo)},

test/license-test/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM public.ecr.aws/docker/library/golang:1.23
1+
FROM public.ecr.aws/docker/library/golang:1.24
22

33
WORKDIR /app
44

test/readme-test/spellcheck-Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23
1+
FROM golang:1.24
22

33
RUN go install github.com/client9/misspell/cmd/[email protected]
44

0 commit comments

Comments
 (0)