If you have a balcony, you can create a garden. The key is to maximize the available space. Don't think of vegetables as if they are popping out of the ground under your feet.
To make the tomato plant grow upside down, make a hole in the bottom of the plastic container. Make a hole in the bottom of the container large enough to hold the plant, but small enough so you don't lose the soil. You can also get information about balcony herb hire through various online sites.
Image Source: Google
Cut a piece of garden towel or plastic slightly larger than the hole in the container. Make an X shape in the plastic and slide it over the tomato plant. Then place the plastic plant upside down through the hole in the bottom of the container.
Hang your container with the tomatoes at the bottom and fill the top of the container with soil. You will pour the tomatoes over the container.
Cucumbers would be fine if they had a trellis to climb on. You can use a garden fence with netting, wire mesh, or sticks. Plant the cucumbers in a medium-sized container. As they grow, help them climb. If you have a fence around the balcony, you can teach them to grow around it.
Growing bush vegetables also takes up less space. Look for cucumber bushes and berry bushes to maximize space. Root vegetables grow in containers if there is sufficient depth.