我遵循这教程,以便在ASG终止实例之前执行shell命令。
但是,当SSM试图调用脚本时,我一直收到这个错误。
步骤正在验证目标实例上的SSM代理可用性时,逐步超时。实例上的SSM代理: i-07b0850b2f3ced30c不起作用。有关更多诊断细节,请参阅自动化服务故障排除指南。
我遗漏了什么?这是因为SSM代理停止了吗?这与权限有关吗?
这是我正在使用的自动化:
description: 'This document will disjoin instances From an Active Directory, create an AMI of the instance, send a signal to LifeCycleHook to terminate the instance'
schemaVersion: '0.3'
assumeRole: '{{automationAssumeRole}}'
parameters:
automationAssumeRole:
default: 'arn:aws:iam::012345678901:role/automationAssumeRole'
description: (Required) The ARN of the role that allows automation to perform the actions on your behalf.
type: String
ASGName:
default: My_AutoScalingGroup
type: String
InstanceId:
type: String
LCHName:
default: my-lifecycle-hook
type: String
mainSteps:
- inputs:
DocumentName: AWS-RunShellScript
InstanceIds:
- '{{ InstanceId }}'
TimeoutSeconds: 3600
Parameters:
commands: ifconfig
executionTimeout: '7200'
name: DoSomething
action: 'aws:runCommand'
onFailure: 'step:TerminateTheInstance'
- inputs:
LifecycleHookName: '{{ LCHName }}'
InstanceId: '{{ InstanceId }}'
AutoScalingGroupName: '{{ ASGName }}'
Service: autoscaling
Api: CompleteLifecycleAction
LifecycleActionResult: CONTINUE
name: TerminateTheInstance
action: 'aws:executeAwsApi'发布于 2021-11-13 17:50:34
在运行文档时,实例已经被管理了吗?应该是..此错误表示ssm代理在实例上没有活动,因此命令没有传递。
我不认为ssm代理会因为规模缩小而停止。因为实例处于终止状态:由于生命周期挂钩,等待状态。
发布于 2021-12-29 14:58:30
我也犯了同样的错误,并通过下面的故障排除步骤修复了它。
在windows实例中启动SSM代理的文档:
{
"schemaVersion": "2.0",
"description": "Start SSM agent on instance",
"mainSteps": [
{
"action": "aws:runPowerShellScript",
"name": "runPowerShellScript",
"inputs": {
"runCommand": [
"Start-Service AmazonSSMAgent"
]
}
}
]
}希望这些步骤对你有帮助,谢谢。
https://stackoverflow.com/questions/68471099
复制相似问题