Search code examples
amazon-web-servicesgoaws-sdkamazon-rdsaws-sdk-go

List available AWS RDS instance type with go SDK


I'm trying to list all the available instance types that I can spawn for a given db engine (postgres/mysql). This at the moment is possible using the aws cli with the following command:

aws rds describe-orderable-db-instance-options --engine mysql

more options can be seen on this docs page - describe-orderable-db-instance-options

However when I try to achieve the same with the aws go-sdk I can't find any similar function that can give me the list of available instances. Docs can be referred here - https://pkg.go.dev/github.com/aws/aws-sdk-go/service/rds

I am NOT interested in trying to list the provisioned instance and examine their instance types. Instead this is supposed to be a pre-provisioning step that allows me to choose available instance types.


Solution

  • Probably this is what you are looking for:

    func (*RDS) DescribeOrderableDBInstanceOptions(input *DescribeOrderableDBInstanceOptionsInput) (*DescribeOrderableDBInstanceOptionsOutput, error)

    Returns a list of orderable DB instance options for the specified DB engine, DB engine version, and DB instance class.

    Usage:

    input := &rds.DescribeOrderableDBInstanceOptionsInput{
            Engine:          aws.String("mysql"),
            EngineVersion:   aws.String("5.6.27"),
            LicenseModel:    aws.String("general-public-license"),
            Vpc:             aws.Bool(true),
        }