First, search for and open Lambda.
In the Functions section, click Create function.
Choose Author from scratch, type labFunction for name, and select Python 3.11.
Scroll down and select use existing Execution role and lab_function_role. Click Create function.
Scroll down to Code.
Delete the code and paste the sample code. Ensure we have the appropriate parameters that we are looking for.
Scroll down and ensure we have the correct print statements and if-else conditions.
Scroll down and review the return statement. Click Test.
Type MyTestEvent for the name, select private event sharing, and choose the Mobile Backend Template. Add the emoji_type to the JSON data. Click Save.
Click Test. Ensure that the execution status displays Succeeded and that our code is displayed with the result.
Go to the Monitor tab and click View CloudWatch logs.
Click the first Log stream.
Review the labFunction logs.
Return to the Lambda console and go back to the Test tab. Change the emoji_type value to 3. Click Save and then Test.
Click the drop-down details and ensure that the changed value has given us a new output.
Now edit the Lambda code to assign different values to their own feelings.
Go back to the test event and assign a value to a positive, neutral, or negative message. Click Save and Test.
Click the details drop-down and ensure our Lambda function has executed properly. Success!