there is a lot of material on this forum on this topic, but to summarize it is the following:

don't bet an A-high flop WITH NO LIKELY DRAWS (AA7 definitely, or AJ5 probably... often even 2 suited if you have the K of that suit), with KK if it's checked to you in position. Be prepared to call at least one sensible (0.5-1x pot) bet before folding. What you do when faced with a second bet depends on your read and the situation and the size of the bet and board texture.

The situation is murkier if you have KK out of position. I'm usually betting it and folding to stiff resistance.