Skip to content

Commit 57f388c

Browse files
authored
update readme and fix some usage text (#1)
1 parent 565d148 commit 57f388c

File tree

4 files changed

+37
-31
lines changed

4 files changed

+37
-31
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ matrix:
1616
script: make go-report-card-test
1717
env: GO_REPORT_CARD=true
1818
- stage: Test
19+
if: type = push AND env(DOCKER_USERNAME) IS present
1920
script: make output-validation-test
2021
env: CFN_AND_TERRAFORM_OUTPUT_VALIDATION_TESTS=true
2122
- stage: Test

README.md

+27-22
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Instance Selector can also be consumed as a go library for direct integration in
4040
## Installation and Configuration
4141

4242
```
43-
curl -Lo ec2-instance-selector https://github.com/aws/amazon-ec2-instance-selector/releases/download/latest/instance-selector-$(uname | tr '[:upper:]' '[:lower:]')-amd64
43+
curl -Lo ec2-instance-selector https://github.com/aws/amazon-ec2-instance-selector/releases/download/v0.8.0/ec2-instance-selector-`uname | tr '[:upper:]' '[:lower:]'`-amd64 && chmod +x ec2-instance-selector
4444
```
4545

4646
To execute the CLI, you will need AWS credentials configured. Take a look at the [AWS CLI configuration documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#config-settings-and-precedence) for details on the various ways to configure credentials. An easy way to try out the ec2-instance-selector CLI is to populate the following environment variables with your AWS API credentials.
@@ -53,9 +53,14 @@ export AWS_SECRET_ACCESS_KEY="..."
5353
If you already have an AWS CLI profile setup, you can pass that directly into ec2-instance-selector:
5454

5555
```
56-
$ ec2-instance-selector --profile=my-aws-cli-profile --vcpus=2
56+
$ ec2-instance-selector --profile my-aws-cli-profile --vcpus 2 --region us-east-1
5757
```
5858

59+
You can set a REGION environment variable if you don't want to pass in `--region` on each run.
60+
61+
```
62+
$ export REGION="us-east-1"
63+
```
5964

6065
## Examples
6166

@@ -125,8 +130,8 @@ Usage:
125130
ec2-instance-selector [flags]
126131
127132
Examples:
128-
ec2-instance-selector --vcpus=4 --region=us-east-2 --availability-zone=us-east-2b
129-
ec2-instance-selector --memory-min=4096 --memory-max=8192 --vcpus-min=4 --vcpus-max=8 --region=us-east-2
133+
ec2-instance-selector --vcpus 4 --region us-east-2 --availability-zone us-east-2b
134+
ec2-instance-selector --memory-min 4096 --memory-max 8192 --vcpus-min 4 --vcpus-max 8 --region us-east-2
130135
131136
Filter Flags:
132137
-z, --availability-zone string Availability zone or zone id to check only EC2 capacity offered in a specific AZ
@@ -136,29 +141,29 @@ Filter Flags:
136141
--current-generation Current generation instance types (explicitly set this to false to not return current generation instance types)
137142
-e, --ena-support Instance types where ENA is supported or required
138143
-f, --fpga-support FPGA instance types
139-
--gpu-memory-total Number Number of GPUs' total memory in `MiB` (Example: 4096) (sets --gpu-memory-total-min and -max to the same value)
140-
--gpu-memory-total-max Number Maximum Number of GPUs' total memory in `MiB` (Example: 4096) If --gpu-memory-total-min is not specified, the lower bound will be 0
141-
--gpu-memory-total-min Number Minimum Number of GPUs' total memory in `MiB` (Example: 4096) If --gpu-memory-total-max is not specified, the upper bound will be infinity
142-
-g, --gpus Number Total Number of GPUs (Example: 4) (sets --gpus-min and -max to the same value)
143-
--gpus-max Number Maximum Total Number of GPUs (Example: 4) If --gpus-min is not specified, the lower bound will be 0
144-
--gpus-min Number Minimum Total Number of GPUs (Example: 4) If --gpus-max is not specified, the upper bound will be infinity
144+
--gpu-memory-total int Number of GPUs' total memory in MiB (Example: 4096) (sets --gpu-memory-total-min and -max to the same value)
145+
--gpu-memory-total-max int Maximum Number of GPUs' total memory in MiB (Example: 4096) If --gpu-memory-total-min is not specified, the lower bound will be 0
146+
--gpu-memory-total-min int Minimum Number of GPUs' total memory in MiB (Example: 4096) If --gpu-memory-total-max is not specified, the upper bound will be infinity
147+
-g, --gpus int Total Number of GPUs (Example: 4) (sets --gpus-min and -max to the same value)
148+
--gpus-max int Maximum Total Number of GPUs (Example: 4) If --gpus-min is not specified, the lower bound will be 0
149+
--gpus-min int Minimum Total Number of GPUs (Example: 4) If --gpus-max is not specified, the upper bound will be infinity
145150
--hibernation-support Hibernation supported
146151
--hypervisor string Hypervisor: [xen or nitro]
147-
-m, --memory Amount Amount of Memory available in MiB (Example: 4096) (sets --memory-min and -max to the same value)
148-
--memory-max Amount Maximum Amount of Memory available in MiB (Example: 4096) If --memory-min is not specified, the lower bound will be 0
149-
--memory-min Amount Minimum Amount of Memory available in MiB (Example: 4096) If --memory-max is not specified, the upper bound will be infinity
150-
--network-interfaces Number Number of network interfaces (ENIs) that can be attached to the instance (sets --network-interfaces-min and -max to the same value)
151-
--network-interfaces-max Number Maximum Number of network interfaces (ENIs) that can be attached to the instance If --network-interfaces-min is not specified, the lower bound will be 0
152-
--network-interfaces-min Number Minimum Number of network interfaces (ENIs) that can be attached to the instance If --network-interfaces-max is not specified, the upper bound will be infinity
153-
--network-performance Gib/s Bandwidth in Gib/s of network performance (Example: 100) (sets --network-performance-min and -max to the same value)
154-
--network-performance-max Gib/s Maximum Bandwidth in Gib/s of network performance (Example: 100) If --network-performance-min is not specified, the lower bound will be 0
155-
--network-performance-min Gib/s Minimum Bandwidth in Gib/s of network performance (Example: 100) If --network-performance-max is not specified, the upper bound will be infinity
152+
-m, --memory int Amount of Memory available in MiB (Example: 4096) (sets --memory-min and -max to the same value)
153+
--memory-max int Maximum Amount of Memory available in MiB (Example: 4096) If --memory-min is not specified, the lower bound will be 0
154+
--memory-min int Minimum Amount of Memory available in MiB (Example: 4096) If --memory-max is not specified, the upper bound will be infinity
155+
--network-interfaces int Number of network interfaces (ENIs) that can be attached to the instance (sets --network-interfaces-min and -max to the same value)
156+
--network-interfaces-max int Maximum Number of network interfaces (ENIs) that can be attached to the instance If --network-interfaces-min is not specified, the lower bound will be 0
157+
--network-interfaces-min int Minimum Number of network interfaces (ENIs) that can be attached to the instance If --network-interfaces-max is not specified, the upper bound will be infinity
158+
--network-performance int Bandwidth in Gib/s of network performance (Example: 100) (sets --network-performance-min and -max to the same value)
159+
--network-performance-max int Maximum Bandwidth in Gib/s of network performance (Example: 100) If --network-performance-min is not specified, the lower bound will be 0
160+
--network-performance-min int Minimum Bandwidth in Gib/s of network performance (Example: 100) If --network-performance-max is not specified, the upper bound will be infinity
156161
--placement-group-strategy string Placement group strategy: [cluster, partition, spread]
157162
--root-device-type string Supported root device types: [ebs or instance-store]
158163
-u, --usage-class string Usage class: [spot or on-demand]
159-
-c, --vcpus Number Number of vcpus available to the instance type. (sets --vcpus-min and -max to the same value)
160-
--vcpus-max Number Maximum Number of vcpus available to the instance type. If --vcpus-min is not specified, the lower bound will be 0
161-
--vcpus-min Number Minimum Number of vcpus available to the instance type. If --vcpus-max is not specified, the upper bound will be infinity
164+
-c, --vcpus int Number of vcpus available to the instance type. (sets --vcpus-min and -max to the same value)
165+
--vcpus-max int Maximum Number of vcpus available to the instance type. If --vcpus-min is not specified, the lower bound will be 0
166+
--vcpus-min int Minimum Number of vcpus available to the instance type. If --vcpus-max is not specified, the upper bound will be infinity
162167
--vcpus-to-memory-ratio string The ratio of vcpus to memory in MiB. (Example: 1:2)
163168
164169
Global Flags:

cmd/main.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ func main() {
8484
longUsage := binName + ` is a CLI tool to filter EC2 instance types based on resource criteria.
8585
Filtering allows you to select all the instance types that match your application requirements.
8686
Full docs can be found at github.com/aws/` + binName
87-
examples := fmt.Sprintf(`%s --vcpus=4 --region=us-east-2 --availability-zone=us-east-2b
88-
%s --memory-min=4096 --memory-max=8192 --vcpus-min=4 --vcpus-max=8 --region=us-east-2`, binName, binName)
87+
examples := fmt.Sprintf(`%s --vcpus 4 --region us-east-2 --availability-zone us-east-2b
88+
%s --memory-min 4096 --memory-max 8192 --vcpus-min 4 --vcpus-max 8 --region us-east-2`, binName, binName)
8989

9090
cli := commandline.New(binName, shortUsage, longUsage, examples)
9191

@@ -98,12 +98,12 @@ Full docs can be found at github.com/aws/` + binName
9898
// Registers flags with specific input types from the cli pkg
9999
// Filter Flags - These will be grouped at the top of the help flags
100100

101-
cli.IntMinMaxRangeFlags(vcpus, cli.StringMe("c"), nil, "`Number` of vcpus available to the instance type.")
102-
cli.IntMinMaxRangeFlags(memory, cli.StringMe("m"), nil, "`Amount` of Memory available in MiB (Example: 4096)")
101+
cli.IntMinMaxRangeFlags(vcpus, cli.StringMe("c"), nil, "Number of vcpus available to the instance type.")
102+
cli.IntMinMaxRangeFlags(memory, cli.StringMe("m"), nil, "Amount of Memory available in MiB (Example: 4096)")
103103
cli.RatioFlag(vcpusToMemoryRatio, nil, nil, "The ratio of vcpus to memory in MiB. (Example: 1:2)")
104104
cli.StringFlag(cpuArchitecture, cli.StringMe("a"), nil, "CPU architecture [x86_64, i386, or arm64]", nil)
105-
cli.IntMinMaxRangeFlags(gpus, cli.StringMe("g"), nil, "Total `Number` of GPUs (Example: 4)")
106-
cli.IntMinMaxRangeFlags(gpuMemoryTotal, nil, nil, "`Number` of GPUs' total memory in `MiB` (Example: 4096)")
105+
cli.IntMinMaxRangeFlags(gpus, cli.StringMe("g"), nil, "Total Number of GPUs (Example: 4)")
106+
cli.IntMinMaxRangeFlags(gpuMemoryTotal, nil, nil, "Number of GPUs' total memory in MiB (Example: 4096)")
107107
cli.StringFlag(placementGroupStrategy, nil, nil, "Placement group strategy: [cluster, partition, spread]", nil)
108108
cli.StringFlag(usageClass, cli.StringMe("u"), nil, "Usage class: [spot or on-demand]", nil)
109109
cli.StringFlag(rootDeviceType, nil, nil, "Supported root device types: [ebs or instance-store]", nil)
@@ -115,8 +115,8 @@ Full docs can be found at github.com/aws/` + binName
115115
cli.StringFlag(hypervisor, nil, nil, "Hypervisor: [xen or nitro]", nil)
116116
cli.StringFlag(availabilityZone, cli.StringMe("z"), nil, "Availability zone or zone id to check only EC2 capacity offered in a specific AZ", nil)
117117
cli.BoolFlag(currentGeneration, nil, nil, "Current generation instance types (explicitly set this to false to not return current generation instance types)")
118-
cli.IntMinMaxRangeFlags(networkInterfaces, nil, nil, "`Number` of network interfaces (ENIs) that can be attached to the instance")
119-
cli.IntMinMaxRangeFlags(networkPerformance, nil, nil, "Bandwidth in `Gib/s` of network performance (Example: 100)")
118+
cli.IntMinMaxRangeFlags(networkInterfaces, nil, nil, "Number of network interfaces (ENIs) that can be attached to the instance")
119+
cli.IntMinMaxRangeFlags(networkPerformance, nil, nil, "Bandwidth in Gib/s of network performance (Example: 100)")
120120

121121
// Configuration Flags - These will be grouped at the bottom of the help flags
122122

test/output-validation-test/test-output-validation

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -euo errexit
2+
set -euo pipefail
33

44
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
55
BUILD_DIR="$SCRIPTPATH/../../build"

0 commit comments

Comments
 (0)