Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅
中国的 Amazon Web Services 服务入门
(PDF)。
使用 Amazon SDK 重启 Amazon RDS 数据库实例
以下代码示例显示了如何重启 Amazon RDS 数据库实例。
- Java
-
- SDK for Java 2.x
-
public static void rebootInstance(RdsClient rdsClient, String dbInstanceIdentifier ) {
try {
RebootDbInstanceRequest rebootDbInstanceRequest = RebootDbInstanceRequest.builder()
.dbInstanceIdentifier(dbInstanceIdentifier)
.build();
RebootDbInstanceResponse instanceResponse = rdsClient.rebootDBInstance(rebootDbInstanceRequest);
System.out.print("The database "+ instanceResponse.dbInstance().dbInstanceArn() +" was rebooted");
} catch (RdsException e) {
System.out.println(e.getLocalizedMessage());
System.exit(1);
}
}
有关 Amazon 软件开发工具包开发人员指南和代码示例的完整列表,请参阅 将此服务与 Amazon SDK 结合使用。本主题还包括有关入门的信息以及有关先前的软件开发工具包版本的详细信息。