1. 程式人生 > 實用技巧 >在Linux/redhat中安裝amazon-ssm-agent及注意事項

在Linux/redhat中安裝amazon-ssm-agent及注意事項

作業系統:Red Hat Enterprise Linux Server release 7.9 (Maipo)

首先說明一下SSM是什麼、引用官網的說明:

AWS Systems Manager Agent (SSM Agent) is Amazon software that can be installed and configured on an EC2 instance, an on-premises server, or a virtual machine (VM). SSM Agent makes it possible for Systems Manager to update, manage, and configure these resources. The agent processes requests from the Systems Manager service in
the AWS Cloud, and then runs them as specified in the request. SSM Agent then sends status and execution information back to the Systems Manager service by using the Amazon Message Delivery Service (service prefix: ec2messages).
View Code

在此筆者記錄一下在RHEL 7.X中安裝 SSM Agent 的過程

1、下載並安裝,需要將下面的region替換自己所處的region,也可以直接yum跟上url進行安裝,不過建議分為兩步執行:

[root@qq-5201351 ~]# wget https://s3.region.amazonaws.com/amazon-ssm-region/latest/linux_amd64/amazon-ssm-agent.rpm
[root@qq-5201351 ~]# rpm -ivh amazon-ssm-agent.rpm

2、啟動並設定為開機啟動(一般上面安裝後也就預設啟動了)

[root@qq-5201351 ~]# systemctl restart amazon-ssm-agent
[root@qq-5201351 ~]# systemctl enable amazon-ssm-agent

3、例項的role下的策略需要有【AmazonSSMManagedInstanceCore

然後再去AWS Systems Manager介面下的節點管理中就可以看到剛才安裝了amazon-ssm-agent的主機了

總結一下,安裝SSM-Agent的幾點注意事項:

1.需要在例項客戶端上安裝 amazon-ssm-agent並啟動
2.檢查例項有繫結的role中有沒有 AmazonSSMManagedInstanceCore
3.ssm-agent所在的例項,註冊到ssm控制檯,需要通過外網,對於有的環境訪問是走的第4步的方法
4.也有特殊的環境,訪問ssm控制檯外網,是通過Endpoint,需要在相應的Endpoint中介面的安全組上放行上面例項的IP或CIDR,筆者在專案中是隻放行HTTPS/TCP/443埠