Amazon EC2 Mac实例补丁管道是一种自动化流程,可用于定期升级、安装和测试Amazon EC2 Mac实例的操作系统、应用程序和其他组件的最新修补程序。以下是使用AWS Systems Manager Automation文档的示例。
{
"schemaVersion": "1.2",
"description": "Patch for Amazon EC2 Mac instances",
"parameters": {
"AutomationAssumeRole": {
"type": "String",
"description": "The ARN of the role that allows Automation to perform the actions on the resources."
},
"PatchGroup": {
"type": "String",
"description": "The name of the patch group where the instances are assigned.",
"default": "MacInstances"
}
},
"mainSteps": [
{
"name": "AgentCheck",
"action": "aws:runCommand",
"description": "Check if SSM Agent is installed",
"precondition": {
"StringEquals": [
"platformType",
"MacOS"
]
},
"inputs": {
"DocumentName": "AWS-RunShellScript",
"InstanceIds": "{{ InstanceId }}",
"Comment": "{{ AutomationDocumentName }}",
"Parameters": {
"commands": [
"/usr/bin/test -f /usr/local/amazon/bin/amazon-cloudwatch-agent || echo SSM_AGENT_NOT_FOUND",
"[[ -z `pgrep -f amazon-cloudwatch-agent` ]] || echo CLOUDWATCH_AGENT_FOUND_RUNNING",
"sg=$(dscl . -read /Groups/admin GroupMembership 2>/dev/null | awk '{print $2}')",
"[[ -n $(dscl . -read /Groups/$sg GroupMembership 2>/dev/null | grep 'root') ]] || echo NOT_IN_ADMIN_GROUP"
]
},
"CloudWatchOutputConfig": {
"CloudWatchLogGroupName": "{{ AutomationExecutionId }}",
"CloudWatchOutputEnabled": true
},
"MaxConcurrency": "50",
"MaxErrors": "0"
},
"nextStep": "InstallSSMAgent",