Above answers are bit old.
Firstly create a key-pair and then attach it to Elastic Beanstalk environment.
Steps to create a key-pair
Steps to attach created key pair to Elastic Beanstalk environment
AWS -> Services -> Elastic Beanstalk
Select your environment and click on the configuration in left.
In Configuration overview select modify from Security.
Under Virtual machine permissions select key-pair that we created.
Click on save and then on save configuration.
This will take some time to reflect to your EC2 instance.