@James *******
you CAN appky for CoE weeks in advance, but honestly I would apply around 10 days prior departure. If something changes (i.e. flight cancelled), you have to have your CoE changed. At the moment you can not do that online yourself (nor simply apply for a new one), so you have to contact your embassy directly and ask for a change.
Turnaround time for CoE is quite fast, often only hours. But in the USA they wait until 3 days before your departure to issue it (to avoid changes after issuance).