For Ubuntu, I run the following commands:
sudo systemctl enable snapd
sudo systemctl start snapd
sudo snap install amazon-ssm-agent --classic
sudo snap list amazon-ssm-agent
sudo snap start amazon-ssm-agent
sudo snap services amazon-ssm-agent
On the rare occasion, you have to add in the private AWS routes for the agent to check in. make sure to add your gateway IP
route -p add 169.254.169.254 MASK 255.255.255.255 gw_ip_here
route -p add 169.254.169.250 MASK 255.255.255.255 gw_ip_here
route -p add 169.254.169.251 MASK 255.255.255.255 gw_ip_here
route -p add 169.254.169.249 MASK 255.255.255.255 gw_ip_here
route -p add 169.254.169.123 MASK 255.255.255.255 gw_ip_here
route -p add 169.254.169.253 MASK 255.255.255.255 gw_ip_here