RHEL8 EC2インスタンスにSSM Agentをインストールする方法

環境
RHEL8.6
AWS EC2

操作方法
1.VPCエンドポイントは次のものを準備します
S3接続用のエンドポイント
エンドポイントサービス名 com.amazonaws.ap-northeast-1.s3

Systems Manager接続用のエンドポイント
エンドポイントサービス名

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
com.amazonaws.ap-northeast-1.ssm
com.amazonaws.ap-northeast-1.ssmmessages
com.amazonaws.ap-northeast-1.ec2messages
com.amazonaws.ap-northeast-1.ssm com.amazonaws.ap-northeast-1.ssmmessages com.amazonaws.ap-northeast-1.ec2messages
com.amazonaws.ap-northeast-1.ssm
com.amazonaws.ap-northeast-1.ssmmessages
com.amazonaws.ap-northeast-1.ec2messages

2.EC2を構築する
#cd /tmp

amazon-ssm-agentをインストールする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo dnf --disablerepo="*" install -y https://s3.ap-northeast-1.amazonaws.com/amazon-ssm-ap-northeast-1/latest/linux_amd64/amazon-ssm-agent.rpm
sudo dnf --disablerepo="*" install -y https://s3.ap-northeast-1.amazonaws.com/amazon-ssm-ap-northeast-1/latest/linux_amd64/amazon-ssm-agent.rpm
sudo dnf --disablerepo="*" install -y https://s3.ap-northeast-1.amazonaws.com/amazon-ssm-ap-northeast-1/latest/linux_amd64/amazon-ssm-agent.rpm

自動起動を有効にする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo systemctl enable amazon-ssm-agent
sudo systemctl enable amazon-ssm-agent
sudo systemctl enable amazon-ssm-agent

SSM Agentの起動を行う

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo systemctl start amazon-ssm-agent
sudo systemctl start amazon-ssm-agent
sudo systemctl start amazon-ssm-agent

次のコマンドを実行してSSM Agentのステータスを確認します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
systemctl status amazon-ssm-agent
systemctl status amazon-ssm-agent
systemctl status amazon-ssm-agent

 

AWS

Posted by arkgame