我用lambda编写了python代码,用于从SSM运行命令,但出错了。
响应:{ "errorMessage":“2019-11-26T10:51:09.649Zd6a9aff6-9da9-477c-82b4-100d96a316fe任务在3.00秒后超时”}
请求ID:"d6a9aff6-9da9-477c-82b4-100d96a316fe“
功能日志:启动RequestId: d6a9aff6-9da9-477c-82b4-100d96a316fe版本:$LATEST END RequestId: d6a9aff6-9da9-477c-82b4-100d96a316fe报告RequestId: d6a9aff6-9da9-9da9-82c-82b4-100d96a316fe持续时间: 3003.16 ms记帐时间: 3000 ms内存大小:128mb内存使用: 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)
发布于 2019-11-26 13:01:53
看起来,Lambda函数上的超时值设置设置为3秒,但是完成SSM命令所需的时间比SSM命令所用的时间要长(如在SSM命令上设置的600秒超时所示)。您需要增加Lambda函数的超时。
https://stackoverflow.com/questions/59049601
复制相似问题