I was trying to deploy my Nodejs application in Elastic Beanstalk but I keep a 502 Bad Gateway error.
I checked the health causes
How I solved it
When uploading your code to the elastic beanstalk, it is expected to be zipped.
I zipped all my files excluding the node_modules and it worked perfectly.
Hope this helps someone in deploying your application to elastic beanstalk