By using AWS re:Post, you agree to the Terms of Use

How to Identify the cost effective rds instance from the list of instances returned by describe-orderable-db-instances api using pricing get-products api

0

I am using golang sdk to get a list of possible rds instances that I can launch in my account from DescribeOrderableDBInstanceOptionsWithContext golang SDK method. I need to find out the most cost effective instance from the response of previous method/api call. For that purpose I am trying to integrate with pricing service get products API(https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_GetProducts.html#API_pricing_GetProducts_ResponseSyntax). I am struggling to parse the response of this API(https://docs.aws.amazon.com/sdk-for-go/api/service/pricing/#Pricing.GetProductsWithContext) which looks something like below in golang to get the appropriate price of the instances and then select the cheapest one.

{ FormatVersion: "aws_v1", PriceList: [{ publicationDate: "2022-07-20T21:49:04Z", product: map[attributes:map[currentGeneration:Yes databaseEdition:Express databaseEngine:SQL Server deploymentOption:Single-AZ engineCode:10 instanceFamily:General purpose instanceType:db.t3.large instanceTypeFamily:T3 licenseModel:License included location:US West (Oregon) locationType:AWS Region memory:8 GiB networkPerformance:Low to Moderate normalizationSizeFactor:NA operation:CreateDBInstance:0010 physicalProcessor:Intel Skylake E5 2686 v5 (2.5 GHz) processorArchitecture:64-bit regionCode:us-west-2 servicecode:AmazonRDS servicename:Amazon Relational Database Service storage:EBS Only usagetype:USW2-InstanceUsage:db.t3.large vcpu:2] productFamily:Database Instance sku:4GXHZ5GR8C5DZW8W], serviceCode: "AmazonRDS", terms: map[OnDemand:map[4GXHZ5GR8C5DZW8W.JRTCKXETXF:map[effectiveDate:2022-07-01T00:00:00Z offerTermCode:JRTCKXETXF priceDimensions:map[4GXHZ5GR8C5DZW8W.JRTCKXETXF.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:USD 0.162 per db.t3.large Single-AZ instance hour (or partial hour) running SQL Server Exp (LI) endRange:Inf pricePerUnit:map[USD:0.1620000000] rateCode:4GXHZ5GR8C5DZW8W.JRTCKXETXF.6YS6EN2CT7 unit:Hrs]] sku:4GXHZ5GR8C5DZW8W termAttributes:map[]]] Reserved:map[4GXHZ5GR8C5DZW8W.38NPMPTW36:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:38NPMPTW36 priceDimensions:map[4GXHZ5GR8C5DZW8W.38NPMPTW36.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:850] rateCode:4GXHZ5GR8C5DZW8W.38NPMPTW36.2TG2D8R56U unit:Quantity] 4GXHZ5GR8C5DZW8W.38NPMPTW36.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Express (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0324000000] rateCode:4GXHZ5GR8C5DZW8W.38NPMPTW36.6YS6EN2CT7 unit:Hrs]] sku:4GXHZ5GR8C5DZW8W termAttributes:map[LeaseContractLength:3yr OfferingClass:standard PurchaseOption:Partial Upfront]] 4GXHZ5GR8C5DZW8W.4NA7Y494T4:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:4NA7Y494T4 priceDimensions:map[4GXHZ5GR8C5DZW8W.4NA7Y494T4.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Express (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.1019000000] rateCode:4GXHZ5GR8C5DZW8W.4NA7Y494T4.6YS6EN2CT7 unit:Hrs]] sku:4GXHZ5GR8C5DZW8W termAttributes:map[LeaseContractLength:1yr OfferingClass:standard PurchaseOption:No Upfront]] 4GXHZ5GR8C5DZW8W.6QCMYABX3D:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:6QCMYABX3D priceDimensions:map[4GXHZ5GR8C5DZW8W.6QCMYABX3D.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:833] rateCode:4GXHZ5GR8C5DZW8W.6QCMYABX3D.2TG2D8R56U unit:Quantity] 4GXHZ5GR8C5DZW8W.6QCMYABX3D.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Express (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0000000000] rateCode:4GXHZ5GR8C5DZW8W.6QCMYABX3D.6YS6EN2CT7 unit:Hrs]] sku:4GXHZ5GR8C5DZW8W termAttributes:map[LeaseContractLength:1yr OfferingClass:standard PurchaseOption:All Upfront]] 4GXHZ5GR8C5DZW8W.HU7G6KETJZ:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:HU7G6KETJZ priceDimensions:map[4GXHZ5GR8C5DZW8W.HU7G6KETJZ.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:425] rateCode:4GXHZ5GR8C5DZW8W.HU7G6KETJZ.2TG2D8R56U unit:Quantity] 4GXHZ5GR8C5DZW8W.HU7G6KETJZ.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Express (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0485000000] rateCode:4GXHZ5GR8C5DZW8W.HU7G6KETJZ.6YS6EN2CT7 unit:Hrs]] sku:4GXHZ5GR8C5DZW8W termAttributes:map[LeaseContractLength:1yr OfferingClass:standard PurchaseOption:Partial Upfront]] 4GXHZ5GR8C5DZW8W.NQ3QZPMQV9:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:NQ3QZPMQV9 priceDimensions:map[4GXHZ5GR8C5DZW8W.NQ3QZPMQV9.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:1666] rateCode:4GXHZ5GR8C5DZW8W.NQ3QZPMQV9.2TG2D8R56U unit:Quantity] 4GXHZ5GR8C5DZW8W.NQ3QZPMQV9.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Express (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0000000000] rateCode:4GXHZ5GR8C5DZW8W.NQ3QZPMQV9.6YS6EN2CT7 unit:Hrs]] sku:4GXHZ5GR8C5DZW8W termAttributes:map[LeaseContractLength:3yr OfferingClass:standard PurchaseOption:All Upfront]]]], version: "20220720214904" },{ publicationDate: "2022-07-20T21:49:04Z", product: map[attributes:map[currentGeneration:Yes databaseEdition:Web databaseEngine:SQL Server deploymentOption:Single-AZ engineCode:11 instanceFamily:General purpose instanceType:db.t3.large instanceTypeFamily:T3 licenseModel:License included location:US West (Oregon) locationType:AWS Region memory:8 GiB networkPerformance:Low to Moderate normalizationSizeFactor:NA operation:CreateDBInstance:0011 physicalProcessor:Intel Skylake E5 2686 v5 (2.5 GHz) processorArchitecture:64-bit regionCode:us-west-2 servicecode:AmazonRDS servicename:Amazon Relational Database Service storage:EBS Only usagetype:USW2-InstanceUsage:db.t3.large vcpu:2] productFamily:Database Instance sku:QUKK5XGBC6BV7E3R], serviceCode: "AmazonRDS", terms: map[OnDemand:map[QUKK5XGBC6BV7E3R.JRTCKXETXF:map[effectiveDate:2022-07-01T00:00:00Z offerTermCode:JRTCKXETXF priceDimensions:map[QUKK5XGBC6BV7E3R.JRTCKXETXF.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:USD 0.232 per db.t3.large Single-AZ instance hour (or partial hour) running SQL Server Web (LI) endRange:Inf pricePerUnit:map[USD:0.2320000000] rateCode:QUKK5XGBC6BV7E3R.JRTCKXETXF.6YS6EN2CT7 unit:Hrs]] sku:QUKK5XGBC6BV7E3R termAttributes:map[]]] Reserved:map[QUKK5XGBC6BV7E3R.38NPMPTW36:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:38NPMPTW36 priceDimensions:map[QUKK5XGBC6BV7E3R.38NPMPTW36.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:1219] rateCode:QUKK5XGBC6BV7E3R.38NPMPTW36.2TG2D8R56U unit:Quantity] QUKK5XGBC6BV7E3R.38NPMPTW36.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Web (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0464000000] rateCode:QUKK5XGBC6BV7E3R.38NPMPTW36.6YS6EN2CT7 unit:Hrs]] sku:QUKK5XGBC6BV7E3R termAttributes:map[LeaseContractLength:3yr OfferingClass:standard PurchaseOption:Partial Upfront]] QUKK5XGBC6BV7E3R.4NA7Y494T4:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:4NA7Y494T4 priceDimensions:map[QUKK5XGBC6BV7E3R.4NA7Y494T4.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Web (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.1461000000] rateCode:QUKK5XGBC6BV7E3R.4NA7Y494T4.6YS6EN2CT7 unit:Hrs]] sku:QUKK5XGBC6BV7E3R termAttributes:map[LeaseContractLength:1yr OfferingClass:standard PurchaseOption:No Upfront]] QUKK5XGBC6BV7E3R.6QCMYABX3D:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:6QCMYABX3D priceDimensions:map[QUKK5XGBC6BV7E3R.6QCMYABX3D.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:1195] rateCode:QUKK5XGBC6BV7E3R.6QCMYABX3D.2TG2D8R56U unit:Quantity] QUKK5XGBC6BV7E3R.6QCMYABX3D.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Web (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0000000000] rateCode:QUKK5XGBC6BV7E3R.6QCMYABX3D.6YS6EN2CT7 unit:Hrs]] sku:QUKK5XGBC6BV7E3R termAttributes:map[LeaseContractLength:1yr OfferingClass:standard PurchaseOption:All Upfront]] QUKK5XGBC6BV7E3R.HU7G6KETJZ:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:HU7G6KETJZ priceDimensions:map[QUKK5XGBC6BV7E3R.HU7G6KETJZ.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:609] rateCode:QUKK5XGBC6BV7E3R.HU7G6KETJZ.2TG2D8R56U unit:Quantity] QUKK5XGBC6BV7E3R.HU7G6KETJZ.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Web (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0696000000] rateCode:QUKK5XGBC6BV7E3R.HU7G6KETJZ.6YS6EN2CT7 unit:Hrs]] sku:QUKK5XGBC6BV7E3R termAttributes:map[LeaseContractLength:1yr OfferingClass:standard PurchaseOption:Partial Upfront]] QUKK5XGBC6BV7E3R.NQ3QZPMQV9:map[effectiveDate:2019-11-01T00:00:00Z offerTermCode:NQ3QZPMQV9 priceDimensions:map[QUKK5XGBC6BV7E3R.NQ3QZPMQV9.2TG2D8R56U:map[appliesTo:[] description:Upfront Fee pricePerUnit:map[USD:2389] rateCode:QUKK5XGBC6BV7E3R.NQ3QZPMQV9.2TG2D8R56U unit:Quantity] QUKK5XGBC6BV7E3R.NQ3QZPMQV9.6YS6EN2CT7:map[appliesTo:[] beginRange:0 description:SQL Server Web (License Included), db.t3.large reserved instance applied endRange:Inf pricePerUnit:map[USD:0.0000000000] rateCode:QUKK5XGBC6BV7E3R.NQ3QZPMQV9.6YS6EN2CT7 unit:Hrs]] sku:QUKK5XGBC6BV7E3R termAttributes:map[LeaseContractLength:3yr OfferingClass:standard PurchaseOption:All Upfront]]]], version: "20220720214904" }] } Is there any documentation which list down the response structure because currently its a nested map with no structure defined of key and values. Also which field should I consider to get the price for an rds instance ?

1 Answers
0
  • PriceList []aws.JSONValue is a nested map with no defined structure of keys and values and what is the exact value I should consider for the cost of that instance.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions