AWS Builder Center
From AWS FAQs to Quizzes with Amazon Bedrock

From AWS FAQs to Quizzes with Amazon Bedrock

How I used prompt templates and Bedrock to generate AWS quiz questions in a serverless web app.

Cloud Engineer | AWS | Generative AI & Agentic AI

From AWS FAQs to Quizzes with Amazon Bedrock

Introduction

I recently completed the AWS SimuLearn: Generate an AWS Q&A Application hands-on lab on AWS Skill Builder.
Preparing for AWS certifications often involves reading extensive documentation and FAQs. While these resources are valuable, reviewing large amounts of information can be time-consuming.
What if we could use generative AI to transform AWS FAQs into interactive practice questions?
That's exactly what I explored in this lab using Amazon Bedrock, prompt templates, and serverless AWS services.

1. The Solution Architecture

The lab demonstrates a serverless web application that generates AWS quiz questions using foundation models through Amazon Bedrock.
The architecture includes:
  • Amazon S3: Stores the static web application.
  • Amazon CloudFront: Delivers the web application to users.
  • Amazon API Gateway: Exposes a REST API for quiz generation requests.
  • AWS Lambda: Processes requests and invokes Amazon Bedrock.
  • Amazon Bedrock: Generates questions and answers using a foundation model.
  • Boto3: Provides Python access to the Amazon Bedrock API.
The application follows this workflow:
User → Web App → API Gateway → Lambda → Amazon Bedrock → Generated Quiz
This architecture demonstrates how generative AI can be integrated into a web application without managing dedicated application servers.

2. Generating Questions with Prompt Templates

One of the most interesting parts of the lab was working with prompt templates.
Instead of writing a completely new prompt for every request, we can define a reusable template that guides the model to generate questions in a consistent structure.
For example, a template could contain instructions such as:
Generate four multiple-choice questions about Amazon SageMaker. Each question should have four answer options, one correct answer, and a brief explanation.
The application can customize the prompt based on the selected AWS service or FAQ topic.
This helped me understand that prompt engineering is not just about asking questions. It is also about designing reusable instructions that produce structured and useful outputs.

3. Integrating Amazon Bedrock with AWS Lambda

The lab also demonstrated how Python applications can invoke Amazon Bedrock through Boto3.
At a high level, the backend performs three operations:
  1. Receives a quiz generation request from API Gateway.
  1. Constructs a prompt using the selected template and sends it to Amazon Bedrock.
  1. Returns the generated questions to the web application.
I also explored how Lambda environment variables can be used to select different FAQ templates without modifying the main application logic.
This is useful because it separates application configuration from the code that processes requests.

4. Key Lessons Learned

Although this lab was simpler than some of my previous AWS exercises, it reinforced several useful concepts.
Prompt templates improve reusability. A well-designed template can be reused across different AWS topics while keeping the expected output format consistent.
Serverless architecture simplifies integration. AWS Lambda and API Gateway provide a straightforward way to expose generative AI capabilities through an API.
AI-generated content still requires validation. Even when questions are generated from carefully designed prompts, their technical accuracy, answer choices, and explanations should be reviewed before being used for serious exam preparation.
Another interesting takeaway was the distinction between generating questions from a prompt and grounding those questions in retrieved source documentation.
For a more advanced application, Retrieval-Augmented Generation (RAG) could help incorporate relevant documentation into the generation process.

5. Final Thoughts

This lab demonstrated a practical use case for Amazon Bedrock: transforming technical learning material into interactive quizzes.
My biggest takeaway is:
The value of generative AI comes not only from the model itself, but also from how we structure prompts and integrate the model into useful applications.
For future improvement, I would like to explore adding document retrieval, question difficulty levels, and automated answer validation to make the quiz application more reliable and useful.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article