After removing a key from ec2 instance I can still access with that key
I replaced the old public key in authorized_keys file on an ec2 instance with a new public key. I restarted the ssh service with sudo service sshd restart but I can still access the ec2 instance with the old key.
Solution
Check if you removed the authorized keys for all users
Check userdata if the scripts add ssh keys
Check /etc/sshd/sshd_config (path might differ on other systems) if additional authorized_keys files are configured