In this example, the verb "costar" here means "to be difficult" and it acts like the verb "gustar". It can be hard to translate word by word into English. In this example, "Me cuesta despertarme temprano.", the subject is "despertarme" and it is being difficult on "me", which is the object. The verb "despertarse" (to wake up) is reflexive when describing someone waking up on their own. Thus, in the first-person singular, we attach the object personal pronoun "me" to the infinitive "despertar", i.e., "despertarme".
In this example, the verb "costar" here means "to be difficult" and it acts like the verb "gustar". It can be hard to translate word by word into English. In this example, "Me cuesta despertarme temprano.", the subject is "despertarme" and it is being difficult on "me", which is the object. The verb "despertarse" (to wake up) is reflexive when describing someone waking up on their own. Thus, in the first-person singular, we attach the object personal pronoun "me" to the infinitive "despertar", i.e., "despertarme".