列出使用Go SDK可用的AWS RDS实例类型。

huangapple go评论79阅读模式
英文:

List available AWS RDS instance type with go SDK

问题

我正在尝试列出我可以为给定的数据库引擎(postgres/mysql)生成的所有可用实例类型。目前可以使用aws命令行工具来实现,使用以下命令:

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

更多选项可以在此文档页面中查看 - describe-orderable-db-instance-options

然而,当我尝试使用aws go-sdk来实现相同的功能时,我找不到任何类似的函数可以给我提供可用实例的列表。可以在这里参考文档 - https://pkg.go.dev/github.com/aws/aws-sdk-go/service/rds

想尝试列出已配置的实例并检查它们的实例类型。相反,这应该是一个预配置步骤,允许我选择可用的实例类型。

英文:

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.

答案1

得分: 3

可能这就是你在寻找的内容:

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

> 返回指定数据库引擎、数据库引擎版本和数据库实例类别的可订购的数据库实例选项列表。

用法:

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

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),
	}

huangapple
  • 本文由 发表于 2021年12月27日 17:28:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/70493720.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定