From de46c1f50565bbe2e79f7c431df1256a48915c76 Mon Sep 17 00:00:00 2001 From: Brandon Wagner Date: Mon, 11 Apr 2022 15:41:29 -0500 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1ee48c..c66f599 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ brew install ec2-instance-selector #### Install w/ Curl for Linux/Mac ``` -curl -Lo ec2-instance-selector https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.2.0/ec2-instance-selector-`uname | tr '[:upper:]' '[:lower:]'`-amd64 && chmod +x ec2-instance-selector +curl -Lo ec2-instance-selector https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.3.0/ec2-instance-selector-`uname | tr '[:upper:]' '[:lower:]'`-amd64 && chmod +x ec2-instance-selector ``` 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. From 69ef9dde66d50080bf1bc79c5d3d0017cdc6d304 Mon Sep 17 00:00:00 2001 From: "Rodrigo O.C. Pereira" <68402662+digocorbellini@users.noreply.github.com> Date: Wed, 15 Jun 2022 17:42:42 -0500 Subject: [PATCH 2/2] fixed issue with OD pricing for european regions (#132) * fixed issue with OD pricing for european regions * made string replacement more readable in getRegionForPricingAPI Co-authored-by: Rodrigo Okamoto --- pkg/ec2pricing/odpricing.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/ec2pricing/odpricing.go b/pkg/ec2pricing/odpricing.go index 3052191..f4ea64b 100644 --- a/pkg/ec2pricing/odpricing.go +++ b/pkg/ec2pricing/odpricing.go @@ -22,6 +22,7 @@ import ( "os" "path/filepath" "strconv" + "strings" "time" "github.com/aws/aws-sdk-go/aws" @@ -214,6 +215,12 @@ func (c *OnDemandPricing) getRegionForPricingAPI() string { regionDescription = region.Description() } } + + // endpoints package returns European regions with the word "Europe," but the pricing API expects the word "EU." + // This formatting mismatch is only present with European regions. + // So replace "Europe" with "EU" if it exists in the regionDescription string. + regionDescription = strings.ReplaceAll(regionDescription, "Europe", "EU") + return regionDescription }