Unmanned aerial vehicles provide new opportunities for performance improvements in future wireless communications systems. For example, they can act as relays that extend the range of a communication link and improve the capacity. Unlike conventional relays that are deployed at fixed locations, UAVs can change their positions to optimize the capacity or range on demand. In this paper, we consider using a swarm of UAVs as amplify-and-forward MIMO relays to provide connectivity between an obstructed multi-antenna equipped source and destination. We start by optimizing UAV placement for the single antenna case, and analyze its dependence on the noise introduced by the relay, its gain, and transmit power constraint. We extend our analysis for an arbitrary UAV swarm and show how the MIMO link capacity can be optimized by changing the distance of the swarm to the source and the destination. Then, we consider the effect of optimizing the positions of the UAVs within the swarm and derive an upper bound for the capacity at any given placement of the swarm. We also propose a simple near optimal approach to find the positions that optimize the capacity for the end-to-end link given that the source and the destination have uniform rectangular arrays.Index Terms-Unmanned aerial vehicle (UAV), amplify and forward relay, MIMO capacity.