I have a hard lump an inch behind ear on the line joining head and neck. Its pea sized, painless and seems like its attached to the bone?

Lymph node. What you described suggests a slightly enlarged lymph gland/node. You could watch and wait. You may feel the node every couple of weeks, if the lymph gland doubles in size, becomes painful, ulcerates, or other nodes become enlarged, or you develop fever, or lose weight, you should see a doctor.
Wish you good health! - Have a diet rich in fresh vegetables, fruits, whole grains, milk and milk products, nuts, beans, legumes, lentils and small amounts of lean meats. Avoid saturated fats. Drink enough water daily, so that your urine is mostly colorless. Exercise at least 150 minutes/week and increase the intensity of exercise gradually. Do not use tobacco, alcohol, weed or street drugs in any form.
Practice safe sex, if you have sex.