Introduction
🧑🍳 What is Amazon Q CLI?
Amazon Q Developer CLI, popularly referred to as Amazon Q CLI is a command-line tool developed by AWS that integrates Amazon Q, a generative AI-powered assistant, into your terminal.
The tool leverages AI to help dev enthusiasts build applications by typing in plain(ish) English - like asking it questions, getting code, running tasks etc.
Amazon Q CLI is like talking to your cloud services using a magical command-line genie that understands what you mean, not just what you type.
🛠️ What makes it cool?
Natural language to code – Talk like a human, get dev-grade output.
Smart suggestions – “You asked for X, but also consider Y.”
Command line native – Lives in your terminal like a helpful ghost.
Context-aware – Knows about your AWS environment and your project.
🧃 TL;DR:
Amazon Q CLI is like ChatGPT for your cloud - but instead of chit-chat, it gets real work done in your AWS setup, straight from the terminal.
Reminiscing the good old days, I developed Rock, Paper, Scissors game in Python3 without writing a single line of code, and simply providing a prompt to Amazon Q CLI!
Continue reading .. to learn how you can do the same in a matter of minutes!
Cost
None!
Amazon Q Developer CLI can be used for free through the AWS Free Tier! To access it, you can sign up for an AWS Builder ID, which does not require an AWS account. This allows you to explore the features of Amazon Q Developer CLI, including natural language command execution and code transformation, within certain usage limits.
The functionality being used in this blog lies within the free tier and will not incur any costs if you choose to follow along or develop a game inspired by this blog.
Amazon Q CLI installation
-
Install Amazon Q CLI
The steps for installing Amazon Q CLI are available in the official AWS documentation -
Authenticate Amazon Q CLI by running the command:
q login
. This opens a browser window for authentication. Log in with your AWS Builder ID to access the free-tier.
You can run your prompts directly on the Q CLI, or as I am doing in this blog - via the VSCode extension. -
Install VS Code Extension (Optional)
a) Open Visual Studio Code.
b) Go to Extensions (Ctrl+Shift+X)
.
c) Search for Amazon Q
.
d) Click Install
on the official Amazon Q extension.
4) Configure Amazon Q in VS Code (Optional)
a) Open the Command Palette (Ctrl+Shift+P)
.
b) Type and select “Amazon Q: Connect”
.
c) Follow prompts to authenticate using your AWS Builder ID (same as CLI).
5) Test Setup
a) Run q help
in a VS Code terminal or on the Q CLI (if you are not using the VSCode IDE)
b) Use commands like q ask or q code to verify integration.
Implementation - Prompt and Amazon Q CLI output
Click the Amazon Q CLI
extension icon in your VSCode to start the implementation!
Let's enter our first prompt!
Game - Version 1
Amazon Q CLI not only wrote a Python script for the Rock, Paper, Scissors
game, but also generated well documented instructions in README.md
describing the functionality and execution instructions!
Let us test what we created!
While this version of the implementation aligns well with the input prompt, works well and is without any (visible) bugs, let's see if we can UP our game!
Updated prompt and Amazon Q output
Prompt 2
update the code to take the player's name as input for a more personalized feel. Update the quality of the game graphics and change the color scheme to something more subtle that works well in both light and dark themed devices
Game - Version 2
Now that looks much better! While there is a slight rendering issue, the look and feel of the game has improved to a great extent. You may continue interacting with Amazon Q CLI to tweak the game as per your liking.
I noticed that Amazon Q did not update the
README.md
andgame_specs.txt
files this time around. Probably my prompt was the culprit here, since I only asked it to "update the code". Another reminder for us that AI assistants are only as good as the prompt!
Prompt 3
update all the files to reflect the latest changes in main.py
Bonus
I asked Amazon Q to create a flowchart of the application and it generated the flowchart in three formats!
A .txt
, a markdown .md
version and a Python script
to generate the flowchart diagram at runtime!
Whaaatttttt???? mind blown
Github Repository
Rock, Paper, Scissors Game
A modern 2D implementation of the classic Rock, Paper, Scissors game built with Python and Pygame, featuring personalized gameplay and enhanced visuals.
Game Rules
- Rock beats scissors
- Scissors beat paper
- Paper beats rock
Features
- Personalized gameplay with player name input
- Modern UI with subtle color scheme for both light and dark themes
- Interactive elements with hover effects and animations
- Score tracking across multiple rounds
- Simple mouse and keyboard controls
- End-game summary with personalized results
Requirements
- Python 3.6 or higher
- Pygame 2.5.2 or higher
Installation
- Clone or download this repository
- Install the required dependencies:
pip install -r requirements.txt
How to Play
- Run the game:
python main.py
- Enter your name when prompted
- Click on one of the colored squares to make your choice
- Red square: Rock
- Green square: Paper
- Blue square: Scissors
- After seeing the result, click
- "Play Again" button to play another round
- "End Game" button to…
Conclusion
AI tools like Amazon Q CLI are incredibly powerful and flexible — they let you talk to your programming language or your cloud setup almost like you're having a conversation, right from the command line. You can ask it to write code, fix bugs, manage services and more, which can save tons of time and make complex tasks easier.
But there's a catch: if you're not familiar with programming or how your systems work, it's easy to make mistakes. You might accidentally change something important, open up a security hole, or rack up unexpected costs. So while these tools are super helpful, they work best when you understand what they’re doing behind the scenes and don’t just trust them blindly.
Remember, AI assistants are only as good as your prompt!
Thank you for stopping by! I hope you found this blog useful! Are you planning to take Amazon Q CLI for a spin? Let me know in the comment section!
References
Build Games with Amazon Q CLI and score a T shirt
Tidak ada komentar:
Posting Komentar