0

I have a running instance that was created without a keypair, as I understandis not possible to apply a keypair to a running instance, I need to ssh connect to the instance to get some logs, how can I do that?

Right click on the instance -> Connect, shows a message saying that the instance is not associated with a key pair and "you will need to log into this instance using a valid username and password combination".

Our app runs on Elastic Beanstalk, the user should be ec2-user, but what about the password? How can I retrieve that?

PS: re-launch the instance with a keypair is not an option....

Thanks!

askedJun 8, 2015 at 11:17
peppeocchi's user avatar

2 Answers2

4

You can download the logs using tail logs or full logs option in the console

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html

The above will get you the default set of log files from the instance. If you want to get your files from one of the non-default locations you will need to update your environment with the following ebextension. Create a filecustom-logs.config in a folder named.ebextensions in your app root. In the contents of your file create a log configuration file that points to your custom location.

Example contents:

files:  "/opt/elasticbeanstalk/tasks/systemtaillogs.d/my-cool-logs.conf" :    mode: "000777"    owner: root    group: root    content: |      /my-framework/my-logs/my-cool-log.log

This file is in yaml format, so be careful with the indentation. After creating this file you can deploy this new app version to your environment. Then when you snapshot logs using the instructions above you will get your custom logs.

answeredJun 8, 2015 at 14:51
Rohit Banga's user avatar
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, thanks for your reply but I have to download logs at the application level (something like my-framework/my-logs/my-cool-log.log)
Thanks @rohit-banga, this is not the solution I was looking for because I have to redeploy the app in order to be able to get the logs with tail logs, that means the current logs will be lost. Your answer is a really great solution for the future, thanks a million!
0

If there's any way to access the command line on your instance then you could

edit

/etc/ssh/sshd_config

setting change the line to:

PasswordAuthentication yes

SSH User:Pass access defaults to no on launch.

answeredJun 8, 2015 at 21:19
russOnXMaps's user avatar

Comments

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.