Execute script while in maintenance mode

I have a cluster hosted in AWS that I have had to place in maintenance mode (stop routing requests) as the incoming requests prevent any work on the cluster in its current state.

Some of the issues are caused by mapping explosion, so I have created the necessary fixed mappings and now need to reindex all of the current indices to hopefully get the cluster back in a somewhat stable state.

I would like to be able to execute a python script to handle the reindexing, as it is very tedious, time consuming and error prone to do it manually via the elastic.co API console. But since the cluster is in maintenance mode I obviously can't get trough to it.

Does anyone know of a solution to my predicament?

PS. there is more to it than just reindexing as some indices also need to be placed under ILM, with the necessary bootstrapping and other forms of clean up.