public static void appendToRemoteFile(String privateKey, String host, String dir, String fileName,
			String payload)
	{
		Assert.hasText(privateKey, "privateKey must not be empty nor null.");
		Assert.hasText(host, "The remote machine's URL must be specified.");
		Assert.notNull(dir, "dir should not be null");
		Assert.hasText(fileName, "The remote file name must be specified.");

		final SshjSshClient client = getSSHClient(host, privateKey);
		client.exec("echo '" + payload + "' >> " + dir + "/" + fileName);
	}
Appends the payload to an existing file on a remote EC2 Instance.

@param privateKey The ssh private key for the remote container
@param host The remote machine's ip.
@param dir The directory to write the file
@param fileName The fully qualified file name of the file to be created.
@param payload the data to append to the file
spring-xd-integration-test/src/main/java/org/springframework/xd/integration/util/StreamUtils.java