我在Lambda中为来自SSM的运行命令编写了python代码,但出现错误 错误
响应: { “ errorMessage”:“ 2019-11-26T10:51:09.649Z d6a9aff6-9da9-477c-82b4-100d96a316fe任务在3.00秒后超时” }
请求ID: “ d6a9aff6-9da9-477c-82b4-100d96a316fe”
功能日志:
START RequestId:d6a9aff6-9da9-477c-82b4-100d96a316fe版本:$ LATEST
END RequestId:d6a9aff6-9da9-477c-82b4-100d96a316fe
REPORT RequestId:d6a9aff6-9da9-477c-82b4-100d96a316fe持续时间:3003.16 ms计费持续时间:3000 ms内存大小:128 MB使用的最大内存:34 MB
2019-11-26T10:51:09.649Z d6a9aff6-9da9-477c-82b4-100d96a316fe任务在3.00秒后超时
代码
from __future__ import print_function
import json
import boto3
import urllib.request
ec2_client = boto3.client('ec2', region_name='us-west-1')
ssm_client = boto3.client('ssm', region_name='us-west-1')
client = boto3.client('ssm')
params={"commands":["mkdir reham1"],"workingDirectory":["/home"],"executionTimeout":["3600"]}
response = ssm_client.send_command(DocumentName="AWS-RunShellScript", InstanceIds="i-0fb28a7b3786adee1",Comment='logging the', TimeoutSeconds=600, Parameters=params)
答案 0 :(得分:0)
似乎Lambda函数上的超时设置设置为3秒,但完成SSM命令所需的时间比设置SSM命令完成的时间长(如您在SSM命令上设置的600秒超时所指示的)。您需要增加Lambda函数的超时时间。