Amazon Web Services
AWS-AI2 intermediate
Call an LLM from your code: Bedrock Converse API in Lambda
Build a ticket-triage function that calls a foundation model with the Converse API, fix the IAM permission it needs, return structured JSON and log token usage – the pattern behind most GenAI features in real applications.
What you'll do
- Call a model with the Bedrock Converse API from Lambda
- Grant bedrock:InvokeModel with IAM
- Ask the model for JSON and parse it
- Log and reason about token usage
Lab tasks
-
1
Create the function
ticket-triage - 2 Write the Converse API call and deploy
- 3 Test – and read the AccessDenied error
- 4 Allow the role to invoke models
- 5 Classify the ticket
- 6 Read the token usage in CloudWatch