On the lower budget end of attaching batteries that I recommend are good quality tie down straps, like the kind used to hold motorcycles upright in the back of trucks. These type of straps are extremely strong and will hold any size batteries in place. Another low budget method I have used is to build a box out of wood. Now I am not sure if this is really a good idea since it is flammable though, however wood boxes can be made to any size necessary and can be made from cabinet grade plywood and clear coated, stained or painted to match the project. There are several scooters on the market such as the Razor EcoSmart that have wood foot boards which sit right in top of the batteries so it is actually not unconventional to use wood around electric scooter and bike batteries.
On the higher end is of course fabricated steel or aluminum boxes.
For electric bicycles batteries are often mounted on top of rear racks, although I do not like this because it makes the center of gravity very high and the bike can get speed wobbles if the rack is not strong enough. Bikes with batteries on rear racks also have a tendency to fall over when the rider gets onto them since the center of gravity is so high. I have installed batteries inside of a bike frame using the low budget method shown below.
What do scratch builders use to hold the 12v22ah batteries in place?