{
"schemaVersion": "2.2",
"description": "Check and update Apache to latest version",
"mainSteps": [
{
"action": "aws:runShellScript",
"name": "checkAndUpdateApache",
"inputs": {
"runCommand": [
"#!/bin/bash",
"CURRENT_VERSION=$(httpd -v | grep -oP 'Apache/\\K[0-9.]+')",
"yum check-update httpd -q | grep -q httpd",
"if [ $? -eq 0 ]; then",
" yum update httpd -y",
" systemctl restart httpd",
"fi"
]
}
}
]
}
JSON
복사
aws ssm create-document \
--name "UpdateApache" \
--content file://update-apache.json \
--document-type "Command"
Shell
복사
aws ssm delete-document --name UpdateApache --region ap-northeast-2
Shell
복사
