Sudden pain upon awakening may be nothing more than staying in one position too long. Do you tend to sleep on one side for a long time? Does the pain go away once you start moving around?
A quick way to find out if position is the problem is to put a pillow between your legs. It must be fat enough and firm enough to hold your legs hip width apart. Make sure your knees and your ankles are supported by the pillow. This will keep one leg from hanging down over the other leg, a position that puts hip muscles on stretch.
You may change positions in your sleep and lose the pillow. Just put it back between your legs if you wake up any time during the night. If your symptoms persist or you develop other symptoms, make an appointment with your medical doctor. If there's nothing seriously wrong, seeing a physical therapist or a chiropractor may be the next step.