This is a simple one to answer : )
Seal your medications in a zip-lock bag and bring on your carry-on, or in your luggage. There are no issues bringing these into Peru.
Unfortunately, Cannabis is not recognized as a medication : ( although the Amazon is full of it, haha : )
If you are about to run out or need more (got lost, wet, etc...) you can easily visit a pharmacy in Iquitos. If it happens to be a medication requiring a prescription we will find you a doctor! No problems, only solutions!