- import json
import boto3
client = boto3.client('ecs')
def lambda_handler(event, context):
return {
response = client.stop_task(
cluster='newCluster',
task='d3a857b8f2e1463d85265e08b6dfd9f3',
reason='none'
)
}
I have written this lambda, but when I test it , it shows syntax error like below
Response: { "errorMessage": "Syntax error in module 'lambda_function': invalid syntax (lambda_function.py, line 8)", "errorType": "Runtime.UserCodeSyntaxError", "stackTrace": [ " File \"/var/task/lambda_function.py\" Line 8\n response = client.stop_task(\n" ] }
Request ID: "9cb74885-0171-4ed9-9e6f-44e50480139b"
Function Logs:
START RequestId: 9cb74885-0171-4ed9-9e6f-44e50480139b Version: $LATEST
[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': invalid syntax (lambda_function.py, line 8)
Traceback (most recent call last):
File "/var/task/lambda_function.py" Line 8
response = client.stop_task(
END RequestId: 9cb74885-0171-4ed9-9e6f-44e50480139b
REPORT RequestId: 9cb74885-0171-4ed9-9e6f-44e50480139b Duration: 27.35 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 56 MB Init Duration: 108.01 ms
XRAY TraceId: 1-5d846522-6de3bafd93f9f6ddd732c151 SegmentId: 5c86ef0b79d59359 Sampled: false