Suppose I am a 17th level character with the Ray of Frost cantrip. By the spell's text, it does 4d8 damage on a hit when cast by a character of this level. However, suppose I want to fire a "warning shot" that will do minimal damage on a hit. Can I choose to have the spell deal 1d8 damage, as if I were a lower-level character?
The damage increase is not optional
By rules as written, a cantrip's damage increase is not optional, but a feature of the spell. For example, in the Ray of Frost spell's text, it says (PHB, p. 271, bold added):
The spell’s damage increases by 1d8 when you reach 5th level (2d8), 11th level (3d8), and 17th level (4d8).
This text implies that the damage increase simply happens, regardless of spellcaster intent. Contrast this with text in spells that say you "can" increase a spell's traits, implying the increase is optional, such as Mordenkainen’s Private Sanctum (PHB, p. 262, bold added):
When you cast this spell using a spell slot of 5th level or higher, you can increase the size of the cube by 100 feet for each slot level beyond 4th.
There are sometimes ways to do "warning shots"
You do have some "warning shot" options for certain cantrips. If the cantrip requires a melee spell attack (such as Shocking Grasp), note that (PHB, p. 198):
When an attacker reduces a creature to 0 hit points with a melee attack, the attacker can knock the creature out. The attacker can make this choice the instant the damage is dealt.
And since melee spell attacks are "melee attack"s, you could subdue an opponent with such a cantrip (as has been clarified in sage advice). However, ranged cantrips are always lethally dangerous.
Finally, note that there are ranged cantrips (like Fire Bolt) which can target either creatures or objects. These cantrips could be used for "warning shots" by destroying a nearby object to demonstrate your power. However, other spells (like Ray of Frost) will only target creatures.