“Attain” means “reach” and “obtain” means “get.” You attain a mountaintop, but obtain a rare baseball card. “Attain” usually implies a required amount of labor or difficulty; nothing is necessarily implied about the difficulty of obtaining that card. Maybe you just found it in your brother’s dresser drawer.
Some things you obtain can also be attained. If you want to emphasize how hard you worked in college, you might say you attained your degree; but if you want to emphasize that you have a valid degree that qualifies you for a certain job, you might say you obtained it. If you just bought it from a diploma mill for fifty bucks, you definitely only obtained it.
Paul Brians' latest blog post talks horse sense.