First, realize you're comparing yourself to other people. I do it too, most people do it at some point. You are not alone. Sh
t like this takes time. No one is immune to feelings of inadequacy, just look at the recent suicides of Kate Spade and other people we deem successful.1. Comparing yourself to other people is a losers game. You will always* find someone else who is smarter/wealthier/beautiful than you, and on the other end you will always find someone who is worse off than you. You are enough.
2. Practice compassion. I keep a "good things" jar on my desk. When something good happens, I write it on a post-it note and put it in the jar.
3. Track what matters in your life. What matters to me, and what probably matters to you, is maintaing health and learning a little each day. Break out a spreadsheet and learn how to be observant to your body. I recommend https://www.trackinghappiness.com/ as a start (I am not affiliated with the site).
4. As previous commenters mentioned, like-it-or-not luck plays a large play in life. However, that doesn't mean you can prepare yourself for when luck or opportunities arise. Based on your handle, you got an internship at Amazon. That didn't happen out of the blue. You had to network, practice coding, and build your skills to get it.
This is a hard thing. Don't be like me and beat yourself up over it because a complete 180 hasn't happened this week. Giving yourself time, combined with discipline, can lead you to the next step. I don't know what that next step is, but go find it.