Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Uninstall EC2 Instance Connect
To disable EC2 Instance Connect, connect to your instance and uninstall the
ec2-instance-connect
package that is installed on the OS. If
the sshd
configuration matches what it was set to when you
installed EC2 Instance Connect, uninstalling ec2-instance-connect
also
removes the sshd
configuration. If you modified the
sshd
configuration after installing EC2 Instance Connect, you must
update it manually.
- Amazon Linux
-
You can uninstall EC2 Instance Connect on Amazon Linux 2023 and Amazon Linux 2 2.0.20190618 or
later, where EC2 Instance Connect is preconfigured.
To uninstall EC2 Instance Connect on an instance launched with Amazon Linux 2
-
Connect to your instance using SSH. Specify the SSH key pair you used for your instance
when you launched it and the default user name for the Amazon Linux 2023 or
Amazon Linux 2 AMI, which is ec2-user
.
For example, the following ssh command connects
to the instance with the public DNS name
ec2-a-b-c-d.us-west-2.compute.amazonaws.com
, using
the key pair my_ec2_private_key.pem
.
$
ssh -i my_ec2_private_key
.pem ec2-user@ec2-a-b-c-d.us-west-2.compute.amazonaws.com
-
Uninstall the ec2-instance-connect
package
using the yum command.
[ec2-user ~]$
sudo yum remove ec2-instance-connect
- Ubuntu
-
To uninstall EC2 Instance Connect on an instance launched with an Ubuntu AMI
-
Connect to your instance using SSH. Specify the SSH key pair you used
for your instance when you launched it and the default user name for the
Ubuntu AMI, which is ubuntu
.
For example, the following ssh command connects to the
instance with the public DNS name ec2-a-b-c-d.us-west-2.compute.amazonaws.com
,
using the key pair my_ec2_private_key.pem
.
$
ssh -i my_ec2_private_key
.pem ubuntu@ec2-a-b-c-d.us-west-2.compute.amazonaws.com
-
Uninstall the ec2-instance-connect
package using the
apt-get command.
ubuntu:~$
sudo apt-get remove ec2-instance-connect