ファイルを一括で取得する方法はなく、行数指定して分割して取得をするしかありません。
100行ずつ取ってきて文字列として繋げる方法です。
private static String downloadFile(AmazonRDS client, DBInstance inscance,
DescribeDBLogFilesDetails file) {
StringBuilder builder = new StringBuilder();
Boolean pending = true;
String marker = "";
try {
while (pending) {
DownloadDBLogFilePortionRequest download =
new DownloadDBLogFilePortionRequest()
.withDBInstanceIdentifier(inscance.getDBInstanceIdentifier())
.withLogFileName(file.getLogFileName())
.withNumberOfLines(100)
.withMarker(marker);
DownloadDBLogFilePortionResult result =
client.downloadDBLogFilePortion(download);
if (result != null) {
pending = result.isAdditionalDataPending();
marker = result.getMarker();
builder.append(result.getLogFileData());
} else {
pending = false;
}
}
} catch (Exception ex) {
}
return builder.toString();
}


