Open Postman to call api.


Open AWS Lambda console.


At books_list page.

At /aws/lambda/books_list page.


Next, we will fix the code to make the function run failed. Copy the following code.
data_books = client.scan(
TableName='Book',
IndexName='name-index'
)

After books_list is deployed successfully. Recall the API as in step 1, the error returned is Internal server error.

Back to /aws/lambda/books_list CloudWatch Logs page.

At the detailed log page. You could see the error. The error is an AccessDeniedException because the Lambda function does not have permission to scan the incorrect table Book or it doesn’t exist.
