Amazon Q Developer Workshop

Amazon Q Logo

Module 2: Creating a Basic Web Application

In this module, you'll use Amazon Q Developer to create a Basic Web application. You'll learn how to leverage Amazon Q to generate code, explain concepts, and help you build a functional web application.

Prerequisites

Step 1: Amazon Q Developer CLI

  1. Input prompt to create Sudoku web application in Terminal
create simple html sudoku web application
02_cli_sudoku
  1. Press t or y to allow Q execute the command to create file
02_cli_trust
  1. Amazon Q Developer CLI will able to
    • 3.1 Create html file which you can see in Project Explorer.
    • 3.2 Describe the application details and usages.
02_cli_sudoku_completed
  1. Open html file and click on Show Preview
02_cli_show
  1. You will able to see web page and able to play Sudoku
02_cli_show
  1. Delete all files
!rm -rf *
  1. Exit Q chat
# Exit Q chat
/quit

# Re-enter Q Chat
q chat

Step 2: Amazon Q Developer IDE

  1. Input prompt to create Sudoku web application in VSCode IDE
create simple html sudoku web application
02_ide_sudoku
  1. Amazon Q will start planing and generating the web applicaiton
02_ide_sudoku_thinking
  1. Amazon Q Developer CLI will able to
    • 3.1 Create html file which you can see in Project Explorer.
    • 3.2 Describe the application details and usages.
02_ide_sudoku_completed
  1. After Amazon Q finished generate the file. You can open html file, click on Show Preview. You will able to see web page and able to play Sudoku
02_ide_sudoku_show

Step 3: Generate Documentation (README)

  1. In IDE, we will use Q Developer agentic capabilities to create documentation by typing /doc in IDE
/doc
02_ide_doc
  1. Select Create a README
02_ide_doc_create
  1. Accept the file to create
02_ide_doc_accept
  1. Review the result
02_ide_review

Note:

You also can create README via CLI by prompt. But you may need to add context first

  1. Add Context files to CLI
/context add *
  1. Prompt: Create readme
Could you create a README file for this application?

(Optional) Step 4: Testing and Debugging with Amazon Q

  1. Open your index.html file in a web browser to test your Sudoku application
  2. If you encounter any issues, use Amazon Q in VS Code or in the terminal to help debug:
"Why isn't this code working as expected?"

describe your issue...
  1. Use Amazon Q's suggestions to fix any bugs or improve functionality

(Optional) Step 5: Adding Final Touches

  1. Use Amazon Q to help you add final touches to your application:

Ask Amazon Q:

"How can I improve the user experience of my Sudoku game?"
"Can you help me add a timer feature to my Sudoku game?"
"How can I save the game state so users can continue later?"
  1. Implement the suggestions that you find valuable

(Optional) Example Prompts for Amazon Q

Here are some example prompts you can use with Amazon Q to help with specific aspects of your Sudoku application:

Next Steps

Congratulations! You've created a Basic Web application with the help of Amazon Q Developer. In the next module, you'll learn how to use more advanced prompting techniques to enhance your application.

Go to Module 3: Enhancing the Application with Advanced Prompting →