aws-doc-sdk-examples icon indicating copy to clipboard operation
aws-doc-sdk-examples copied to clipboard

Epic: Remove duplicate instance classes from DescribeOrderableDBInstanceOptions

Open meyertst-aws opened this issue 1 year ago • 0 comments

@max-webster - Creating an epic to address this in other languages.

See the notes below

  • [x] #6688
  • [x] #6428
  • [ ] Java DescribeOrderableDBInstanceOptions example (the metadata is incorrect)
  • [ ] Kotlin DescribeOrderableDBInstanceOptions example (the metadata is missing)
  • [ ] Go DescribeOrderableDBInstanceOptions example
  • [x] #6427
  • [x] #6099

Expected behavior

I build the Aurora sample code in the C++ SDK and run run_getting_started_with_db_clusters. I expect a prompt like this:

Let's create a DB instance.
The available DB instance classes for your database engine are:
   1: db.r5.12xlarge
   2: db.r5.16xlarge
   3: db.r5.24xlarge
   4: db.r5.2xlarge

and so on for all the eligible instance classes.

Actual behavior

The actual prompt is like so, with all the instance class names doubled:

Let's create a DB instance.
The available DB instance classes for your database engine are:
   1: db.r5.12xlarge
   2: db.r5.12xlarge
   3: db.r5.16xlarge
   4: db.r5.16xlarge
   5: db.r5.24xlarge
   6: db.r5.24xlarge
   7: db.r5.2xlarge
   8: db.r5.2xlarge

This is because at https://github.com/awsdocs/aws-doc-sdk-examples/blob/b20b819fcfadff318cc8cab09f94e6be08c2b140/cpp/example_code/aurora/getting_started_with_db_clusters.cpp#L935C6-L935C43 , the DescribeOrderableDBInstanceOptions() call now returns 2 entries per instance class (at least for most instance classes). One with "StorageType": "aurora" and one with "StorageType": "aurora-iopt1". The entries with "StorageType": "aurora-iopt1" are for the new I/O-optimized feature. The "StorageType": "aurora" ones are more universal because the I/O-optimized feature isn't available for older combinations of engine version and instance class:

$ aws rds describe-orderable-db-instance-options --engine aurora-postgresql | grep StorageType | sort | uniq -c
   1243             "StorageType": "aurora",
    599             "StorageType": "aurora-iopt1",

Therefore I think the best and simplest fix to this code sample is to filter the orderable DB instance classes to only those with the attribute "StorageType": "aurora". Since I think it would be too complicated to offer another choice "I/O-optimized or not?" in the prompts.

I didn't check the other language-specific examples from https://docs.aws.amazon.com/code-library/latest/ug/aurora_example_aurora_CreateDBInstance_section.html , but I presume the same applies if they use the same logic of calling DescribeOrderableDBInstanceOptions().

meyertst-aws avatar Feb 16 '24 19:02 meyertst-aws