So, you have many AWS EC2 instances and you have to open many terminals to enable you control all of then, what if you could easily manage your instances from one instance?
Here are four () easy steps to manage multiple EC2 instances from one (1) instance terminal for better security.
These steps assume that all your instances are in the same region, on the same VPC, all within the same subnet and they all use the same key (it would still work even if they are use different keys just make a few tweaks or if they are on different subnets just make some changes to the Security group).
- Copy all the private CIDR IPv4 addresses for your instances into a document and assign simple names to each like host1.local, host2.local, host3.local, etc. Each one must be on a new line with space between the IPv4 address and the name.
- SSH into one of the instances, and edit the hosts file by running sudo nano /etc/hosts copy and paste all the records created earlier right below 127.0.0.1 [hostname] and save.
- Use SCP to copy the .pem file to the instance, change the permission: chmod 400 /location/to/pem/file.
- connect to the other servers from your instance by running: ssh -i /location/to/pem/file [email protected]
Fast and secure administration through a single SSH on 1 instance.