Use a spice grinder and grind the cooled whole spices until fairly fine. In the meantime, dump the galangal and lemongrass into the wet dry grinder and grind for about 30 seconds. Then add everything else, including the shrimp paste and ground spices, and grind to make a puree. You will probably need to add some of the chile pepper soaking water.
Only grind until it is a fine, smooth and silky puree but not hot, otherwise you will start to cook the paste.