Defending Earth from aliens sounds like a big job, but the bigger one is actually defending alien life from us. The position NASA is hiring for—with the amazing title of Planetary Protection Officer—is probably nothing like the image conjured by the trending headlines.
See, the real challenge isn't so much keeping foreign life away from Earth. In many cases, that's exactly what we're searching for. We don't want it accidentally stuck to a Mars rover's treads, but we still want it. What we definitely don't want is a bunch of Earth life contaminating another planet or moon. This is for two reasons. One, we just shouldn't be spreading our own life to alien ecosystems, since that could disrupt a huge portion of organisms not used to terrestrial lifeforms such as bacteria. Two, we don't want to accidentally “find” life on another planet only to realize that it's our own.
Imagine if the Mars rovers had arrived on the red planet full of bacteria. There's a chance that some of the micro-organisms would be able to survive there. Years in the future, if we found life forms that seem awfully Earth-like, we'd have a much harder time figuring out if these were aliens, or just the descendants of some interplanetary bacterial hitchhikers. Keeping the rovers clean in the first place makes that process of elimination much easier.
Even spacecraft that are going on flybys have to be sterilized, lest they crash land on the sphere they're supposed to be zooming past.
This is a lot harder than it seems. Bacteria are excellent survivors and they live on basically everything. That means that every single tiny bit of a spacecraft has to be sterilized, then has to stay that clean until lift off. When Curiosity went to Mars, there was something of a scandal after a team didn't get proper permission to open a set of three drill bits inside a sterile box. That's how seriously they take contamination.
On the other hand, we didn't bother to sterilize the Voyagers before they headed out to deep space, since they weren't destined to land on any planets. Assuming they don't run headlong into anything, they shouldn't be contamination risks. And, as one What If? XKCD post pointed out, that means that thousands of Earth bacteria are potentially shooting through space right now.
So if you get the NASA job, you won't get to battle for control of Earth from aliens (that, by the way, are unlikely to come in any of our lifetimes). You'll get to do something that's way more important.