Under Systems Manager go to Hybrid Activation’s and create activation
Get activation code and ID
Download ssm manager with this link replacing region names with your region
Replace the placeholder values with the Activation Code and Activation ID generated when you create a managed-instance activation, and with the identifier of the AWS Region you want to download SSM Agent from
sudo yum install -y /tmp/ssm/amazon-ssm-agent.rpm
sudo amazon-ssm-agent -register -code "activation-code" -id "activation-id" -region "region"
sudo systemctl start amazon-ssm-agent
sudo systemctl enable amazon-ssm-agent
Instance is now registered, If you want to deregister it you can use the following AWS CLI command
aws ssm deregister-managed-instance --instance-id "mi-xxxxxxxxx"
If you need to install SSM agent on Centos7 EC2 instance here are the steps.
yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
systemctl status amazon-ssm-agentws.com/ec2-downloads-windows
systemctl enable amazon-ssm-agentws.com/ec2-downloads-windows