Reputation: 379
I wrote python code in lambda for run command from SSM but i had error the error
Response: { "errorMessage": "2019-11-26T10:51:09.649Z d6a9aff6-9da9-477c-82b4-100d96a316fe Task timed out after 3.00 seconds" }
Request ID: "d6a9aff6-9da9-477c-82b4-100d96a316fe"
Function Logs:
START RequestId: d6a9aff6-9da9-477c-82b4-100d96a316fe Version: $LATEST
END RequestId: d6a9aff6-9da9-477c-82b4-100d96a316fe
REPORT RequestId: d6a9aff6-9da9-477c-82b4-100d96a316fe Duration: 3003.16 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 34 MB
2019-11-26T10:51:09.649Z d6a9aff6-9da9-477c-82b4-100d96a316fe Task timed out after 3.00 seconds
the code
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)
Upvotes: 0
Views: 2568
Reputation: 200562
It appears that the timeout setting on your Lambda function is set to 3 seconds, but it takes longer than that for the SSM command to complete (as indicated by the 600 second timeout you have set on the SSM command). You need to increase the timeout on your Lambda function.
Upvotes: 1