Copying files from one EC2 Instance to another

Keywords: LAMP/MAMP/WAMP - AWS - How to - Connectivity (SSH/FTP)

Description:
I have been using Bitnami stacks for well over 10 years, and I am pretty sure that in the past I’ve been able to use my existing EC2 PEM file to connect from one AWS instance to a newly created instance.

  • Both instances use Bitnami LAMP stacks
  • Both use exactly the same EC2 security group
  • The security group has both instance Elastic IP addresses enabled for SSH
  • Both instances were created to use the same PEM file.

I can log into each EC2 instance independently using 2 different PuTTY windows. But when I try to log in from one EC2 instance to the other using the PEM for each, the connection times out. I’ve read the 2 doc pages referenced, plus I’ve searched the internet and found no definitive solution.

How do I log in from one EC2 instance to another based on the parameters above?

Hi @Toolie,

If both instances use the same SSH key, you need to forward the agent when connecting to one instance to be able to connect to the second one

https://documentation.help/PuTTY/pageant-forward.html

If you enable the agent forwarding, you should get a list of available keys when running this command in one of the instances

ssh-add -l

If you get a valid output, you should be able to access the second instance using

ssh bitnami@IP

If the connection times out, that means that there is a connection error (not related to the SSH keys). Please ensure port 22 is accessible by the different instances in the security group.

Hi Jota, thank you for your responses. I have set up Pageant to run on my local machine (first time having to do that). I was able to add the key but it made no difference. Here’s a verbose output with and without the key:

As for the security group opened ports, I have mentioned that both instances are already in the security group. Here is a screen grab:

ports-opened-in-security-group

The first SSH listing is for my home’s static IP address; the second is the old instance IP address, and the third is the new instance IP address. And ports 443 and 80 are also already opened.

I’m working around this issue for my own server, but I have a client with a website 10 times this size that I need to move for the same issue – old PHP. I need to get this figured out for her site, or it will take days to move.

Any ideas?

The security group configuration looks good and you can access both instances from your computer. Can you try to “open” the connections to port 22 to anybody (0.0.0.0/0) just for testing purposes? If that works, I suggest you ask the AWS support team to know what’s happening with your current rules as they all look valid.

I did try opening SSH to all and tested connecting from the old to the new instance and it did work. I have removed that open SSH, and contacted AWS. I am going to file a case with them as soon as they fix my account so I can file it. This server to server transfer has been the worst I’ve experienced, and I’ve over a dozen of these.

As soon as I hear from AWS, I’ll post the results here.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.