
Boosting AWS Dev with Amazon Q CLI: My AI Coding Journey
Discover how Amazon Q CLI improved my AWS dev workflow, from setup to code quality, with practical tips for effective AI collaboration
Abhijeet G. Patil
Amazon Employee
Published May 11, 2025
As a developer working on an AWS infrastructure project, I've had the opportunity to experience firsthand how Amazon Q CLI's Agentic Coding can transform the development workflow. In this blog post, I'll share my journey with Amazon Q, highlighting how it helped me write end-to-end logic, create test cases, improve documentation, and prepare code commits that align with industry standards.
Amazon Q is an AI-powered assistant that helps developers with various coding tasks. The Agentic Coding capabilities allow Amazon Q to take a more proactive role in the development process, understanding project context, suggesting solutions, and even implementing code changes directly. I've been using the Amazon Q CLI, which provides a terminal-based interface for interacting with Amazon Q.
Me: I need to set up a new AWS infrastructure project. Can you help me create the basic structure?
Amazon Q: I'll help you set up the basic structure for an AWS infrastructure project. Let's start by creating the necessary files and directories.
[Amazon Q proceeds to create a project structure with main modules, configuration handling, and basic server setup]
Me: This looks good, but I need to modify the authentication handling to support IAM roles as well.
Amazon Q: I understand. Let's modify the authentication module to support IAM roles in addition to access keys...
[Amazon Q implements the requested changes while maintaining the existing functionality]
This initial interaction saved me hours of boilerplate coding and helped establish a solid foundation for the project.
Me: I need to implement a caching system for API responses with multiple backend options.
Amazon Q: I'll help you implement a flexible caching system with multiple backend options. Let's create an abstract cache interface and then implement specific backends.
[Amazon Q designs and implements a comprehensive caching system with memory, file, and Redis backends]
Me: The Redis implementation needs to handle connection failures more gracefully.
Amazon Q: You're right, let's improve the error handling in the Redis cache implementation...
[Amazon Q enhances the Redis implementation with better error handling and retry logic]
What impressed me most was how Amazon Q understood the architectural implications of my request and implemented a solution that followed best practices for resilience and flexibility.
Me: Can you write comprehensive test cases for the API discovery module?
Amazon Q: I'll create comprehensive test cases for the API discovery module. Let's cover unit tests for endpoint discovery, parameter validation, and error handling.
[Amazon Q generates detailed test cases with mocked dependencies and edge case coverage]
Me: These look good, but we should add tests for when the OpenAPI spec is malformed.
Amazon Q: Good point! Let's add tests for malformed OpenAPI specifications...
[Amazon Q adds additional test cases for error handling with invalid inputs]
The test cases Amazon Q generated were thorough and helped identify several edge cases I hadn't considered.
Me: The README.md file needs updating to include information about the new caching features.
Amazon Q: I'll update the README.md to include information about the new caching features. Let me first analyze the current content and then make appropriate additions.
[Amazon Q updates the documentation with clear explanations, configuration examples, and best practices]
Me: Can you also add a section about performance considerations?
Amazon Q: Certainly! I'll add a section about performance considerations for the caching system...
[Amazon Q adds detailed performance guidance with practical examples]
Amazon Q not only wrote clear documentation but also organized it logically and included practical examples that made complex concepts easier to understand.
Me: Can you review the HTTP client module and suggest improvements?
Amazon Q: I'll review the HTTP client module and suggest improvements. Let me analyze the code first.
[Amazon Q provides a detailed analysis with suggestions for error handling, timeout configurations, and performance optimizations]
Me: These suggestions look good. Can you implement the retry mechanism you suggested?
Amazon Q: I'll implement the retry mechanism with exponential backoff for the HTTP client...
[Amazon Q implements a sophisticated retry mechanism while maintaining backward compatibility]
Having Amazon Q review my code was like having an experienced developer provide feedback, helping me identify areas for improvement I might have missed.

Me: What is next?
Amazon Q: Based on our work so far, here are the next steps I recommend for the OpenAPI MCP Server project:
1. Complete the secrets audit
• We started to address potential secrets in the codebase
• We should run detect-secrets audit .secrets.baseline
• Mark test credentials as false positives
2. Address the remaining warnings
• There's still one warning about an unwaited coroutine in the tests
• This could be fixed by properly awaiting the generate_api_instructions coroutine in the test
3. Add more comprehensive documentation
• Create an AmazonQ.md file with usage examples specific to Amazon Q
• Document how to use the OpenAPI MCP Server with different API types
4. Improve test coverage
• Add more tests for edge cases in the API validation
• Consider adding integration tests with real API endpoints
5. Performance optimization
• Profile the application to identify any bottlenecks
• Optimize the caching strategy for API specifications
6. Consider adding more features
• Support for WebSocket APIs
• Enhanced error handling and reporting
• More authentication methods
Would you like me to help with any of these specific areas?
Me: We can work on improving the functionality. The generated prompts from openAPI to fastmep integration is not of good quality. Is there anyway, we can improve the utility that can interpret the Tools and API operations and generate reliable prompt at least one per tool?
Amazon Q: I'll help you improve the prompt generation functionality for the OpenAPI to FastMCP integration. The current implementation might not be producing high-quality prompts that effectively describe the tools and API operations.
Let's analyze the current prompt generation code and then implement improvements to generate more reliable, detailed prompts for each tool.
[Amazon Q proceeds to help improve the prompt generation functionality]
This interaction demonstrates how Amazon Q can provide structured guidance for project direction while also adapting to specific improvement requests. Instead of following the suggested roadmap items, I chose to focus on improving the prompt generation functionality, and Amazon Q immediately pivoted to help with this specific need.
One of the most valuable aspects of working with Amazon Q was its assistance in preparing code for commits. It helped ensure that my changes met all quality standards before submission, saving me from potential revision requests and streamlining the review process.
Me: I've finished implementing the authentication enhancements. Can you help me prepare this for a code commit?
Amazon Q: I'll help you prepare your authentication enhancements for a code commit. Let's go through a pre-commit checklist:
1. First, let's run the unit tests to make sure everything passes:
[Amazon Q executes the test suite and reports results]
2. Now, let's check for coding standards compliance:
[Amazon Q runs flake8, black, and isort to ensure code quality]
3. Let's run security scans to identify any potential vulnerabilities:
[Amazon Q performs security analysis on the authentication code]
4. Let's verify documentation is up-to-date with your changes:
[Amazon Q reviews and suggests updates to docstrings and README]
5. Let's run type checking with pyright to catch any type-related issues:
[Amazon Q runs pyright and addresses any type warnings]
Me: There are a couple of pyright errors. Can you fix those?
Amazon Q: I'll fix the pyright errors:
[Amazon Q makes the necessary type annotation corrections]
Now all checks are passing. Here's a suggested commit message that follows your team's standards:
Title: feat(auth): Implement OAuth 2.0 and JWT validation
Description:
- Add OAuth 2.0 support with authorization code and client credentials flows
- Implement JWT validation with configurable claims verification
- Add integration with AWS Cognito
- Update documentation with authentication examples
- Add unit tests for new authentication features
Amazon Q's assistance with pre-commit checks was comprehensive, covering not just the code functionality but also quality, security, and documentation aspects. The suggested commit message followed our team's conventional commit format perfectly, making it easy to maintain a clean and informative commit history.
One of the most powerful features of Amazon Q CLI is its ability to integrate with Model Context Protocol (MCP) servers. This integration significantly extends Amazon Q's capabilities by allowing it to interact with specialized tools and services.
The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables communication between LLMs and locally running MCP servers that provide additional tools and resources to extend the capabilities of AI assistants like Amazon Q. MCP allows LLMs to access external data, execute code, and interact with various services while maintaining a consistent interface.
- Extended Functionality: MCP servers add domain-specific capabilities to Amazon Q, allowing it to perform specialized tasks beyond its built-in features.
- Visualization Capabilities: With the AWS Diagram MCP Server, Amazon Q can create visual representations of architecture designs and workflows, making it easier to communicate complex ideas.
- Custom Tool Creation: Developers can create custom MCP servers to add project-specific capabilities to Amazon Q, tailoring it to their unique needs.
- Secure Local Processing: MCP servers run locally, allowing sensitive operations to be performed without sending data to external services.
Setting up an MCP server with Amazon Q CLI is straightforward. For example, to configure the AWS Diagram MCP Server:
This configuration allows Amazon Q to create and generate AWS architecture diagrams directly from your conversations. You can ask Amazon Q to visualize your infrastructure, create sequence diagrams, or design new architecture patterns, and it will use the AWS Diagram MCP Server to generate professional-quality diagrams.
- Break Down Tasks into Manageable Sections: For effective use of Agentic Coding, break down tasks into logical, small sections. Focus on a particular module or component at a time rather than trying to solve everything at once. This keeps the context manageable and leads to better results.
- Establish Technology Choices First: Before diving into coding, finalize your project structure and technology choices. For example, decide on Redis for caching, Python 3.12 for development, Tenacity for resiliency, and Prometheus for observability. Amazon Q can then provide more targeted and relevant assistance.
- Provide Clear Context: The more specific you are about your project and requirements, the better Amazon Q can assist you. Include information about your tech stack, constraints, and objectives.
- Review Generated Code: While Amazon Q produces high-quality code, always review it to ensure it meets your specific requirements and follows your project's conventions.
- Iterate Collaboratively: Don't hesitate to ask Amazon Q to modify its suggestions. The best results come from a collaborative process where you provide feedback and Amazon Q refines its solutions.
- Use Amazon Q for Documentation: Amazon Q excels at creating and updating documentation, saving you time while ensuring your docs are comprehensive and clear.
- Leverage for Test Generation: Amazon Q can generate thorough test cases that cover edge cases you might not have considered.
- Utilize for Code Quality and Security: Take advantage of Amazon Q's ability to perform static code analysis, linting corrections, security scans (like detecting hardcoded secrets), and other quality checks. It can identify issues and implement fixes much faster than manual reviews.
- Configure MCP Servers: Extend Amazon Q's capabilities by configuring relevant MCP servers for your project's specific needs.
- Don't Leave Context Boundaries Open: Sometimes, Amazon Q may lose track of earlier instructions as the conversation progresses. For example, if you specified "For functional testing, do not use mocks" early on, it might later forget and start suggesting mock implementations. Clearly define boundaries and periodically reinforce important constraints.
- Don't Skip Security Reviews: While Amazon Q follows best practices, always review security-sensitive code yourself, especially authentication and authorization implementations.
- Don't Assume Complete Understanding: Amazon Q may not fully understand all the nuances of your project. Provide additional context when necessary.
- Don't Rely on Amazon Q for Business Logic Decisions: Amazon Q can implement business logic, but the decisions about what that logic should be should come from you and your team.
- Don't Accept Generated Code Without Testing: Always test the code generated by Amazon Q to ensure it works as expected in your specific environment.
- Don't Share Sensitive Information: Avoid sharing API keys, passwords, or other sensitive information in your prompts.
My experience with Amazon Q CLI's Agentic Coding has been transformative. It has accelerated my development process, improved code quality, and helped me learn new patterns and practices. While it doesn't replace the need for human expertise and judgment, it serves as an invaluable partner in the development process.
My AWS infrastructure project benefited greatly from Amazon Q's assistance, from initial setup to complex feature implementation and comprehensive testing. The integration with MCP servers further extended Amazon Q's capabilities, making it an even more powerful tool for development.
As AI assistants like Amazon Q continue to evolve, I'm excited to see how they will further enhance the software development process. Remember that the most effective use of Amazon Q comes from treating it as a collaborative partner rather than a replacement for human developers. By providing clear context, iterating on solutions, and applying your own expertise, you can leverage Amazon Q to significantly enhance your productivity and code quality.
Abhijeet G. Patil is a Sr. Solutions Architect at AWS, guiding enterprise customers through cloud migration and modernization. He helps build cutting-edge applications on AWS and contributes to the Machine Learning Technical Field Community, supporting customers in adopting AI/ML. In his free time, he explores emerging technologies and studies historical breakthroughs in theoretical physics.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.