I had invoked a lambda to stop some instances using python boto3 lambda invoke function. I am invoking the function with some payload. The invocation is successful but i do not see any log of execution in cloud watch. Basically seems the code execution did not start.
Code:
def stop_start_server():
#sessions
ec2c = boto3.client('lambda', region)
instance_ids = {'Start_Stop': 'start', 'Instance_list': ['i-07fc5b6xxxx1584d', 'i-0da375xxxxxc2018b']}
load = {"Start_Stop": "stop","Instance_list": instance_ids}
print load
#payload = json.loads(load)
payload= bytes(json.dumps(load))
#payload = str(load)
print payload
response = ec2c.invoke(FunctionName = lambdafunction , InvocationType = 'RequestRe
print response
payload = json.loads(response['Payload'].read())
print payload
Output:
{
u 'Payload': < botocore.response.StreamingBody object at 0x7fd8f9c31350 > , u 'ExecutedVersion': '$LATEST', 'ResponseMetadata': {
'RetryAttempts': 0,
'HTTPStatusCode': 200,
'RequestId': 'efcaf7f4-5847-487f-921a-3e87657a7450',
'HTTPHeaders': {
'x-amzn-requestid': 'efcaf7f4-5847-487f-921a-3e87657a7450',
'content-length': '2',
'x-amz-executed-version': '$LATEST',
'x-amzn-trace-id': 'root=1-5e9a06f7-3c4b263c83bb7989df2b596e;sampled=0',
'x-amzn-remapped-content-length': '0',
'connection': 'keep-alive',
'date': 'Fri, 17 Apr 2020 19:43:55 GMT',
'content-type': 'application/json'
}
}, u 'StatusCode': 200
}
seems like the function is triggered but the code execution did not happen. can some help me with what I ma missing

stop_start_serverfunction does not seem to be your handler. - MarcinAWSLambdaBasicExecutionRolepolicy. This policy includes permissions to write to CloudWatch Logs. See: AWS Lambda Execution Role - AWS Lambda - John Rotenstein