I want to SSH AWS EC2 instance but by just only my computer, like SSH over the key. Only my computer can ssh into that instance. How can I configure it? Thanks.
CodePudding user response:
A common way to achieve that is to setup security group of your instance so that only your IP can access the instance:
CodePudding user response:
As Marcin already answered, you should use security group to restrict access to your IP only. However, whenever you change the network, you have to manually edit that security group again.
One solution would be restrict access using mac address using firewall, something like this:
iptables -A INPUT -p tcp --destination-port 22 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT
iptables -A INPUT -p tcp --destination-port 22 -j DROP