Antibiotics while pregnant

Is it okay to take amoxicillin while pregnant for ear infections? I am in the worst pain ever and it’s the only thing they prescribe I just want to make sure it won’t harm my baby.