How do I get rid of an Ender Dragon on a Realm?

Solution 1:

You've inserted "ender_dragon" as a literal player name. If you want to target generic entities, you will need to use the @e (entity) selector, and specify the savegame ID in the type parameter:

/kill @e[type=ender_dragon]