Test the Functions
Task 6: Test the Functions
In this crucial task, we’ll verify the functionality of our serverless blog-to-audio conversion system. We’ll test the entire workflow, from triggering the initial Lambda function to confirming the creation of the audio file in S3.
Workflow Overview
- Manually trigger the New Post Lambda function
- Function stores data in DynamoDB and sends a message to the SNS topic
- SNS triggers the Convert To Audio function
- Convert To Audio function uses Amazon Polly to create an audio file
- Audio file is stored in the S3 bucket
Step-by-Step Testing Process
1. Trigger the New Post Lambda Function
- Navigate to the AWS Lambda console
- Locate and select the
PostReader_NewPost function - Click the “Test” button
- Verify the success message: “Execution result: succeeded”
2. Confirm DynamoDB Entry
- Open the AWS DynamoDB console
- In the navigation pane, choose “Explore items”
- Select the “posts” table
- Verify the presence of two entries (due to running the test twice)
- Note the
url field in the second entry, indicating successful audio conversion
3. Check Convert to Audio Function Execution
- Return to the AWS Lambda console
- Select the
ConvertToAudio function - Navigate to the “Monitor” tab
- Examine the monitoring charts for function invocation
⚠️ Warning: If you encounter errors:
- Check the “Error count and success rate” chart
- View CloudWatch logs for detailed error messages
- Common issues: Incorrect S3 bucket name in environment variables
4. Verify Audio File in S3
- Open the AWS S3 console
- Locate and select your
audioposts- bucket - Confirm the presence of an MP3 file
- Download and play the file - you should hear Polly’s Joanna voice saying “This is working!”
Troubleshooting Tips
- Double-check all IAM permissions
- Ensure SNS topic and subscription are correctly configured
- Verify environment variables in Lambda functions
- Review CloudWatch logs for detailed error information
Next Steps
Congratulations on successfully testing your serverless blog-to-audio conversion system! In the next task, we’ll explore ways to enhance and optimize your application.
🎉 Task Complete! You’ve verified the core functionality of your serverless application. Proceed to the next exciting challenge in your AWS journey!