Create a tar archive over ssh

Creating an archive of a remote directory over SSH:

ssh <host> "tar czf - /remote/directory/" > output.tgz

Example:

ssh you@hostname "tar czpf - /path/to/directory/" > local-file.tgz