High-bandwidth underwater wireless communication can be achieved over long-distance using a swarm of Autonomous Underwater Vehicles (AUVs) relaying an optical signal. The swarm behavior is of critical importance as it will determine the robustness and the autonomy of the communication link. Each vehicle must remain at a distance lower than the optical communication system range from each other while fighting against environmental disturbances such as ocean current. This technology could be a game changer in the deployment and supervision of future oil wells and of deep sea mining which will be deeper and deeper in the oceans. We developed an optimization program to maximize the communication link autonomy while assuring its robustness. The nonlinear optimization problem is transformed to a Second-Order Cone Problem (SOCP), a special case of convex problems that can be efficiently solved with Yalmip on Matlab. We show on two case studies that the autonomy of the swarm and thus the lifetime of the communication link is increased by more than 10% compared to a direct approach where the reference position of the vehicles is fixed.