Since they are all cubes of the same size, you could get away with linking the mesh data of all cubes, so that every cube becomes an instance of one master cube. To do this, select all cubes at once, make sure one of the cubes is the active object, and press Ctrl + L. Choose Object Data as the option from the menu:
Now, all cubes share the same mesh data, and thus the same UV map, while they can still be simulated as separate objects. You can verify that they are instances of each other by going to the Object data tab, and check if there is a number in front of the F. In my case, I have 12 Cube instances as you can see:
Select one of the cubes and unwrap it, it doesn't really matter which one you choose. The UVMap will apply to all objects at the same time. If you need the cubes to have different materials later on, you can link the material data to the object, see this dropdown box in the material slots area:
By default this is set to Data, meaning that all cubes would receive the same material no matter what you try. But setting it to Object allows you to have different materials on instances of the same geometry.