1
votes

I have deployed my Django project to Amazon Elastic Beanstalk. When you create an EBS environment, you can assign a key pair to it, and use Putty to SSH to the EC2 instance, and everything works, but when you use git aws.push, trying to SSH to the same session (Just loading it in Putty), does not accept the previous key pair, and returns "Server refused our key".

If you assign a new key pair to the EBS environment again, you can SSH using Putty and without any problem, but by assigning a new key, it terminates the current EC2 instance and creates a new one which results in loosing all the settings that you had previously done using SSH.

Any help would be appreciated.

2
Elastic Beanstalk can sometimes replace EC2 instances because your instances are part of an autoscaling group. Are you sure that the instance was not replaced overnight?Rohit Banga
If you prefer not to terminate the previous instance and create a new one, you can also follow the instructions in this document: docs.aws.amazon.com/AWSEC2/latest/UserGuide/… Which I think is really tedious.1man

2 Answers

1
votes

Just use CLI tool command:

eb ssh

from your application directory level and you will be able to ssh to current and any future instance of node.

0
votes

First guess is that your IP address changed. Many ISPs rotate your IP addresses frequently. By default AWS limits access to specific ports by known IP addresses. Assuming your public IP address changed, you will need to update your AWS security settings every time your IP address changes.

Go to your AWS EC2 instance list. Select your instance on the top pane, then look up the security groups on the bottom pane, right column, about five rows down. View the rules. Make sure your machine is listed as a permitted inbound source.

If you edit the rules one of the dropdown values is "My IP". It will refresh the rule to whatever your current public IP address is.