You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* created sorting system based on json pathing
* incorporated sorting system into CLI
* added shorthand sorting fields
* Revert "Handle pricing api change in aws-sdk-go 1.44.46 (#145)
* Revert "Handle pricing api change in aws-sdk-go 1.44.46 (#140)"
This reverts commit cec208c.
* Update aws-sdk-go to v1.44.59
* added sorting example and new help printout to readme
* added jsonpath library license to third party licenses
* changed sorting to use sort.Slice()
* removed need for $ in json path
* shortened sort-by flag description and updated readme
* early sort return for empty and 1 element lists
* added sorter tests
* fixed typos
* reduced scope of if statement in main
Co-authored-by: Brandon Wagner <bmwagner10@gmail.com>
* simplified call to sort instances
* modified tests for new sorting interface
* fixed comment typo
* refactored sorting keys map
Co-authored-by: Rodrigo Okamoto <rodocp@amazon.com>
Co-authored-by: Ciprian Hacman <ciprian@hakman.dev>
Co-authored-by: Brandon Wagner <bmwagner10@gmail.com>
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 (30d avg)
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 (30d avg)
NOTE: 547 entries were truncated, increase --max-results to see more
184
+
```
185
+
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).
186
+
187
+
**Example output of instance type object using Verbose output**
188
+
```
189
+
$ ec2-instance-selector --max-results 1 -v
190
+
[
191
+
{
192
+
"AutoRecoverySupported": true,
193
+
"BareMetal": false,
194
+
"BurstablePerformanceSupported": false,
195
+
"CurrentGeneration": false,
196
+
"DedicatedHostsSupported": true,
197
+
"EbsInfo": {
198
+
"EbsOptimizedInfo": {
199
+
"BaselineBandwidthInMbps": 1750,
200
+
"BaselineIops": 10000,
201
+
"BaselineThroughputInMBps": 218.75,
202
+
"MaximumBandwidthInMbps": 3500,
203
+
"MaximumIops": 20000,
204
+
"MaximumThroughputInMBps": 437.5
205
+
},
206
+
"EbsOptimizedSupport": "default",
207
+
"EncryptionSupport": "supported",
208
+
"NvmeSupport": "required"
209
+
},
210
+
"FpgaInfo": null,
211
+
"FreeTierEligible": false,
212
+
"GpuInfo": null,
213
+
"HibernationSupported": false,
214
+
"Hypervisor": "nitro",
215
+
"InferenceAcceleratorInfo": null,
216
+
"InstanceStorageInfo": null,
217
+
"InstanceStorageSupported": false,
218
+
"InstanceType": "a1.2xlarge",
219
+
"MemoryInfo": {
220
+
"SizeInMiB": 16384
221
+
},
222
+
"NetworkInfo": {
223
+
"DefaultNetworkCardIndex": 0,
224
+
"EfaInfo": null,
225
+
"EfaSupported": false,
226
+
"EnaSupport": "required",
227
+
"EncryptionInTransitSupported": false,
228
+
"Ipv4AddressesPerInterface": 15,
229
+
"Ipv6AddressesPerInterface": 15,
230
+
"Ipv6Supported": true,
231
+
"MaximumNetworkCards": 1,
232
+
"MaximumNetworkInterfaces": 4,
233
+
"NetworkCards": [
234
+
{
235
+
"MaximumNetworkInterfaces": 4,
236
+
"NetworkCardIndex": 0,
237
+
"NetworkPerformance": "Up to 10 Gigabit"
238
+
}
239
+
],
240
+
"NetworkPerformance": "Up to 10 Gigabit"
241
+
},
242
+
"PlacementGroupInfo": {
243
+
"SupportedStrategies": [
244
+
"cluster",
245
+
"partition",
246
+
"spread"
247
+
]
248
+
},
249
+
"ProcessorInfo": {
250
+
"SupportedArchitectures": [
251
+
"arm64"
252
+
],
253
+
"SustainedClockSpeedInGhz": 2.3
254
+
},
255
+
"SupportedBootModes": [
256
+
"uefi"
257
+
],
258
+
"SupportedRootDeviceTypes": [
259
+
"ebs"
260
+
],
261
+
"SupportedUsageClasses": [
262
+
"on-demand",
263
+
"spot"
264
+
],
265
+
"SupportedVirtualizationTypes": [
266
+
"hvm"
267
+
],
268
+
"VCpuInfo": {
269
+
"DefaultCores": 8,
270
+
"DefaultThreadsPerCore": 1,
271
+
"DefaultVCpus": 8,
272
+
"ValidCores": null,
273
+
"ValidThreadsPerCore": null
274
+
},
275
+
"OndemandPricePerHour": 0.204,
276
+
"SpotPrice": 0.03939999999999999
277
+
}
278
+
]
279
+
NOTE: 497 entries were truncated, increase --max-results to see more
280
+
```
281
+
NOTE: Use this JSON format as reference when finding JSON paths for sorting
282
+
149
283
**All CLI Options**
150
284
151
285
```
152
286
$ ec2-instance-selector --help
153
287
```
154
288
155
289
```bash#help
156
-
ec2-instance-selector is a CLI tool to filter EC2 instance types based on resource criteria.
290
+
ec2-instance-selector is a CLI tool to filter EC2 instance types based on resource criteria.
157
291
Filtering allows you to select all the instance types that match your application requirements.
158
292
Full docs can be found at github.com/aws/amazon-ec2-instance-selector
159
293
@@ -241,15 +375,17 @@ Suite Flags:
241
375
242
376
243
377
Global Flags:
244
-
--cache-dir string Directory to save the pricing and instance type caches (default "~/.ec2-instance-selector/")
245
-
--cache-ttl int Cache TTLs in hours for pricing and instance type caches. Setting the cache to 0 will turn off caching and cleanup any on-disk caches. (default 168)
246
-
-h, --help Help
247
-
--max-results int The maximum number of instance types that match your criteria to return (default 20)
248
-
-o, --output string Specify the output format (table, table-wide, one-line)
249
-
--profile string AWS CLI profile to use for credentials and config
250
-
-r, --region string AWS Region to use for API requests (NOTE: if not passed in, uses AWS SDK default precedence)
251
-
-v, --verbose Verbose - will print out full instance specs
252
-
--version Prints CLI version
378
+
--cache-dir string Directory to save the pricing and instance type caches (default "~/.ec2-instance-selector/")
379
+
--cache-ttl int Cache TTLs in hours for pricing and instance type caches. Setting the cache to 0 will turn off caching and cleanup any on-disk caches. (default 168)
380
+
-h, --help Help
381
+
--max-results int The maximum number of instance types that match your criteria to return (default 20)
382
+
-o, --output string Specify the output format (table, table-wide, one-line)
383
+
--profile string AWS CLI profile to use for credentials and config
384
+
-r, --region string AWS Region to use for API requests (NOTE: if not passed in, uses AWS SDK default precedence)
385
+
--sort-by string Specify the field to sort by. Quantity flags present in this CLI (memory, gpus, etc.) or a JSON path to the appropriate instance type field (Ex: ".MemoryInfo.SizeInMiB") is acceptable. (default ".InstanceType")
386
+
--sort-direction string Specify the direction to sort in (ascending, asc, descending, desc) (default "ascending")
387
+
-v, --verbose Verbose - will print out full instance specs
0 commit comments