Basic Area of Effect Rules
As far as Area of Effect goes...
A spell's description specifies its area of effect, which typically has one of five different shapes: cone, cube, cylinder, line, or sphere. Every area of effect has a point of origin, a location from which the spell's energy erupts. The rules for each shape specify how you position its point of origin. Typically, a point of origin is a point in space, but some spells have an area whose origin is a creature or an object.
The linked section goes on to explain exactly what each of the five basic shapes means, and none of them allow for shaping.
Shaping
One of the design precepts of 5th Edition is plain language - in other words, spells, features, and traits only do what they say they do. Take these spell descriptions for example...
You create a wall of fire on a solid surface within range. You can make the wall up to 60 feet long, 20 feet high, and 1 foot thick, or a ringed wall up to 20 feet in diameter, 20 feet high, and 1 foot thick.
An invisible wall of force springs into existence at a point you choose within range. The wall appears in any orientation you choose, as a horizontal or vertical barrier or at an angle. It can be free floating or resting on a solid surface. You can form it into a hemispherical dome or a sphere with a radius of up to 10 feet, or you can shape a flat surface made up of ten 10-foot-by-10-foot panels. Each panel must be contiguous with another panel. In any form, the wall is 1/4 inch thick.
You create a wall of ice on a solid surface within range. You can form it into a hemispherical dome or a sphere with a radius of up to 10 feet, or you can shape a flat surface made up of ten 10-foot-square panels. Each panel must be contiguous with another panel.
A shimmering wall of bright light appears at a point you choose within range. The wall appears in any orientation you choose: horizontally, vertically, or diagonally. It can be free floating, or it can rest on a solid surface. The wall can be up to 60 feet long, 10 feet high, and 5 feet thick.
A nonmagical wall of solid stone springs into existence at a point you choose within range. The wall is 6 inches thick and is composed of ten 10-foot- by-10-foot panels. Each panel must be contiguous with at least one other panel. Alternatively, you can create 10-foot-by-20-foot panels that are only 3 inches thick. [...] The wall can have any shape you desire, though it can't occupy the same space as a creature or object. The wall doesn't need to be vertical or rest on any firm foundation. It must, however, merge with and be solidly supported by existing stone. Thus, you can use this spell to bridge a chasm or create a ramp.
These spells all create walls but have highly specific and different rules for how those walls can be sculpted. Two can float in the air at whatever angle you like (Light and Force), the rest must be touching the ground or a particular material. Some are constructed with panels of a particular size (Force, Ice, Stone), while others have a set size (Light and Fire). Some must be a flat plane or a sphere (Force and Ice), while others infinitely shapeable (Stone) or can do cylindrical rings (Fire).
It's pretty clear from just these examples that the rules for shaping a spell, when available, are specific to the individual spell. What holds true for one spell does not hold true for others.
Conclusion
One of the core concepts of 5E is exception based design. If something is supposed to be different from the general rules, it will say so - and the explicit exception wins. The general rules are covered in Area of Effect, and make no provision for shaping.
As mentioned earlier, another core concept is use natural language. If it doesn't say it can be shaped, it cannot be shaped.
Specific Example
The specific example, Alarm...
Choose a door, a window, or an area within range that is no larger than a 20-foot cube.
One proposed answer to the linked question suggests you can break it up in blocks. The spell does not say a certain number of cubic feet, or panels, or a ring, or anything else. A room is an "area" in plain language, so Alarm fill a room's specific shape, as long as that room is "no larger than a 20-foot cube". If you're outside, it could cover a smaller area (like a clearing) as long as that area is "no larger than a 20-foot cube". But turning it into a ring (squared or otherwise) - nope.