简体   繁体   中英

SSH into EC2 Instance created by EBS

I am using python and Amazon EC2

I am trying to progrmamtically SSH into the instance created by the Elastic Beanstalk Worker. While using 'eb init' there is no option to specify the KeyPair to use for the instance and hence I am not able to SSH into it.

Reason for me to do this is that I want to check if the dependencies in requirements.txt are installed correctly in the instance. Is there any other way to check this other than SSHing into the instance and checking?

Hi you have to declare the keypair to use on the web console.

Go to

elasticbeanstalk > your application > edit configuration > Instances > select keypair

Alternatively, this sounds like a hack but you can write a python script file that call for the modules that you installed and throws an error if the module is not found. The error is captured and you can view it in the web logs.

According to the AWS ElasticBeanstalk CLI docs , you can pass in the key pair name in the init command. The command would be:

eb init MyApplication -k MyKeyPairName

or

eb init MyApplication --keyname MyKeyPairName

eb create also takes a similar argument.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM