How To Install ec2-instance-connect on Ubuntu 20.04
Introduction
In this tutorial we learn how to install ec2-instance-connect on Ubuntu 20.04.
What is ec2-instance-connect
ec2-instance-connect is:
EC2 Instance Connect is a service that publishes ssh keys for use by EC2 instances based on AWS Credentials. These keys are consumed by on-instance configuration provided by this package. The ssh daemon will query EC2 Instance Metadata service for user-keys at ssh calltime, validate any if present as well as validating their signature, and if all checks pass return will include them in the authorized keys list.
In addition, there is an agent that harvests instance ssh host keys and passes them back to the service. This is for authentication purposes by the EC2 console to open an in-browser ssh terminal connection.
Package: ec2-instance-connect Architecture: all Version: 1.1.12+dfsg1-0ubuntu3 Priority: optional Section: net Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Daniel Anderson [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 56 Pre-Depends: adduser Depends: ca-certificates, coreutils (>= 8.0), curl, openssh-server (>= 6.9.0), openssl Filename: pool/main/e/ec2-instance-connect/ec2-instance-connect_1.1.12+dfsg1-0ubuntu3_all.deb Size: 12596 MD5sum: 816d0d8cd10a8c05205cab9cf84f2aac SHA1: d91c2e7d06f5bb32e829d7e38fc6d8733ea697e5 SHA256: ecd01e309c0da18a62c32b80827f9fe3e90a79fe1ab032779bdac231d3245a8b Homepage: https://aws.amazon.com/ Description-en: Configures ssh daemon to accept EC2 Instance Connect ssh keys EC2 Instance Connect is a service that publishes ssh keys for use by EC2 instances based on AWS Credentials. These keys are consumed by on-instance configuration provided by this package. The ssh daemon will query EC2 Instance Metadata service for user-keys at ssh calltime, validate any if present as well as validating their signature, and if all checks pass return will include them in the authorized keys list.
In addition, there is an agent that harvests instance ssh host keys and passes them back to the service. This is for authentication purposes by the EC2 console to open an in-browser ssh terminal connection.
There are three methods to install ec2-instance-connect on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install ec2-instance-connect Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get update
After updating apt database, We can install ec2-instance-connect using apt-get by running the following command:
sudo apt-get -y install ec2-instance-connect
Install ec2-instance-connect Using apt
Update apt database with apt using the following command.
sudo apt update
After updating apt database, We can install ec2-instance-connect using apt by running the following command:
sudo apt -y install ec2-instance-connect
Install ec2-instance-connect Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.
sudo aptitude update
After updating apt database, We can install ec2-instance-connect using aptitude by running the following command:
sudo aptitude -y install ec2-instance-connect
How To Uninstall ec2-instance-connect on Ubuntu 20.04
To uninstall only the ec2-instance-connect package we can use the following command:
sudo apt-get remove ec2-instance-connect
Uninstall ec2-instance-connect And Its Dependencies
To uninstall ec2-instance-connect and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:
sudo apt-get -y autoremove ec2-instance-connect
Remove ec2-instance-connect Configurations and Data
To remove ec2-instance-connect configuration and data from Ubuntu 20.04 we can use the following command:
sudo apt-get -y purge ec2-instance-connect
Remove ec2-instance-connect configuration, data, and all of its dependencies
We can use the following command to remove ec2-instance-connect configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge ec2-instance-connect
References
Summary
In this tutorial we learn how to install ec2-instance-connect package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.