使用适用于 Ruby 的 SDK 的 Aurora 示例
以下代码示例显示了如何通过 IAM 将 适用于 Ruby 的 AWS SDK 与 Aurora 一起使用来执行操作和实现常见场景。
每个示例都包含一个指向完整源代码的链接,您可以从中找到有关如何在上下文中设置和运行代码的说明。
开始使用
以下代码示例显示如何开始使用 Aurora。
- 适用于 Ruby 的 SDK
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 require 'aws-sdk-rds' # Creates an Amazon RDS client for the AWS Region rds = Aws::RDS::Client.new puts 'Listing clusters in this AWS account...' # Calls the describe_db_clusters method to get information about clusters resp = rds.describe_db_clusters(max_records: 20) # Checks if any clusters are found and prints the appropriate message if resp.db_clusters.empty? puts 'No clusters found!' else # Loops through the array of cluster objects and prints the cluster identifier resp.db_clusters.each do |cluster| puts "Cluster identifier: #{cluster.db_cluster_identifier}" end end-
有关 API 详细信息,请参阅《适用于 Ruby 的 AWS SDK API 参考》中的 DescribeDBClusters。
-