Does code cracking still work in the era of modern cryptography? I thought that cryptosystems like AES and others were essentially impossible to crack if implemented right. What role do codebreakers play these days?
The very complex modern approaches to cryptanalysis still borrow from the oldest attacks.
A simple substitution cipher is easily broken by frequency analysis - find the most common letter in the ciphertext and it'll probably be E in the plaintext. Nothing so simple would work today, but we often see vulnerabilities in cryptosystems due to pseudorandom number generators with inadequate entropy. It's the same basic principle (exploiting a lack of randomness to identify patterns in the ciphertext), albeit with vastly more mathematical sophistication. The NSA allegedly took advantage of this principle to deliberately weaken cryptosystems by promoting an intentionally weak PRNG.
frequency analysis works easily if you know the source language, i.e. English in this case, while entropy of the message is critical to cracking, complex approaches are not the only ones which are immune to attacks, for example simple ciphers like using a one time pad is mathematically impossible to crack.
German Enigma operators in WW2 were told always to send a certain number of messages per day to make it harder to perform traffic analysis. One bored operator sent a message composed entirely of "W" repeated 4000 times (or so).
One on-the-ball analyst noticed a message that had no "W"s in it, and deduced what had been sent[0]. That allowed the daily settings to be cracked, and thus all messages for that day.
[0] Enigma has a weakness in that no letter can be encrypted as itself[1].
[1] Enigma is effectively a "one-time-pad" where the pad is a pseudo-random sequence determined by the daily settings.