<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohamed Abomosallam</title>
    <description>The latest articles on DEV Community by Mohamed Abomosallam (@mohamed_abomosallam_52626).</description>
    <link>https://dev.to/mohamed_abomosallam_52626</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3109439%2F7b708660-9d44-4915-a7e4-8c286a7e0485.png</url>
      <title>DEV Community: Mohamed Abomosallam</title>
      <link>https://dev.to/mohamed_abomosallam_52626</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohamed_abomosallam_52626"/>
    <language>en</language>
    <item>
      <title>Dev Productivity, Unleashed: Build Faster with This Amazon Q CLI Workflow</title>
      <dc:creator>Mohamed Abomosallam</dc:creator>
      <pubDate>Sat, 10 May 2025 23:53:16 +0000</pubDate>
      <link>https://dev.to/mohamed_abomosallam_52626/dev-productivity-unleashed-build-faster-with-this-amazon-q-cli-workflow-4h1m</link>
      <guid>https://dev.to/mohamed_abomosallam_52626/dev-productivity-unleashed-build-faster-with-this-amazon-q-cli-workflow-4h1m</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/aws-amazon-q-v2025-04-30"&gt;Amazon Q Developer "Quack The Code" Challenge&lt;/a&gt;: Crushing the Command Line&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;DevOps Config File Generator&lt;/strong&gt;, a command-line automation tool powered by the &lt;strong&gt;Amazon Q Developer CLI&lt;/strong&gt;. It intelligently generates essential DevOps configuration files—such as Dockerfiles, Terraform scripts, Kubernetes manifests, and GitHub Actions workflows—based on prompt templates or custom input.&lt;/p&gt;

&lt;p&gt;Setting up infrastructure and CI/CD pipelines typically involves repetitive boilerplate files. While customizable, these files often follow predictable patterns that are time-consuming and error-prone to recreate manually. My tool solves this by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing &lt;strong&gt;ready-to-edit, high-quality configs&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Reducing setup time and manual errors&lt;/li&gt;
&lt;li&gt;Enabling prompt-based, context-aware file generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s like having an AI-powered config assistant that assists with your DevOps daily tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;🎥 Video 1: Generating a Dockerfile using a pre-defined prompt&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 main.py dockerfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div&gt;
  &lt;iframe src="https://loom.com/embed/87a32b49db034dde8da0dd19e9d815ac"&gt;
  &lt;/iframe&gt;
&lt;/div&gt;



&lt;p&gt;In this video, you can see the usage of the Dockerfile config prompt defined in the CONFIG dictionary within the config.py file. The command python3 main.py dockerfile is run, which triggers the tool to start a subprocess that interacts with the Amazon Q CLI using the chat option. The result is then saved to a Dockerfile in the root directory.&lt;/p&gt;

&lt;p&gt;🎥 Video 2: using the &lt;code&gt;--prompt&lt;/code&gt; flag &lt;br&gt;
&lt;/p&gt;
&lt;div&gt;
  &lt;iframe src="https://loom.com/embed/500016d29f974fa2aad332710772e85d"&gt;
  &lt;/iframe&gt;
&lt;/div&gt;


&lt;p&gt;In the second demo, you can see the usage of &lt;code&gt;--prompt&lt;/code&gt; flag and then passing a completely custom prompt that overwrites the previous Dockerfile, allowing the user to generate a Dockerfile based on their specific requirements and needs&lt;/p&gt;

&lt;p&gt;🎥 Video3: using interactive mode with &lt;code&gt;--multi-stage&lt;/code&gt; demostration capabilities &lt;br&gt;
&lt;/p&gt;
&lt;div&gt;
  &lt;iframe src="https://loom.com/embed/82e3f41be9e04929a4c7fb6ad0cbd8eb"&gt;
  &lt;/iframe&gt;
&lt;/div&gt;


&lt;p&gt;In this lengthy demo, I:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose a file type interactively&lt;/li&gt;
&lt;li&gt;Provide a prompt to generate an AWS VPC with public/private subnets&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;--multi-stage&lt;/code&gt; for step-by-step confirmation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This results in separate generation stages for &lt;code&gt;main.tf&lt;/code&gt;, &lt;code&gt;variables.tf&lt;/code&gt;, and &lt;code&gt;outputs.tf&lt;/code&gt;, each requiring approval before proceeding—perfect for infrastructure tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Repository
&lt;/h2&gt;

&lt;p&gt;You can explore the full source code for this project on my &lt;a href="https://github.com/MohamedAboMousallam/AmazonQuackOps" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The README includes installation instructions and guides for trying the tool locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Used Amazon Q Developer
&lt;/h2&gt;

&lt;p&gt;I used Amazon Q Developer CLI as the intelligence engine behind a lightweight Python wrapper. Here's how:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configuration via &lt;code&gt;config.py&lt;/code&gt;
To manage various file generation scenarios, I created a centralized &lt;code&gt;CONFIG&lt;/code&gt; dictionary in config.py. Each entry defines a prompt and the corresponding output files. Here's an example for generating a generic Dockerfile:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CONFIG = {
    'dockerfile': {
        'prompt': 'Generate a simple generic Dockerfile template for a containerized application. Include comments explaining each instruction. Do not assume a specific language or framework.',
        'files': ['Dockerfile']
    },
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Triggering Q CLI with Python
Using &lt;code&gt;subprocess.run([...])&lt;/code&gt;, my tool wraps Amazon Q’s &lt;code&gt;chat&lt;/code&gt; command to automate code generation:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;chat&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--trust-all-tools&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--prompt&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows for seamless prompt execution and result handling within a Python environment.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tool Permissions and a Word of Caution
In my demo, I used the &lt;code&gt;--trust-all-tools&lt;/code&gt; flag so Q could write files directly (fs_write) without asking for confirmation every time.
&lt;strong&gt;⚠ Important warning&lt;/strong&gt;: Using &lt;code&gt;--trust-all-tools&lt;/code&gt; can be risky because it gives Q blanket access to system-level operations like writing files, executing commands, and interacting with AWS. You should only use it in safe or sandboxed environments.
To learn more about this flag and tool-level permissions, refer to:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-chat-security.html#command-line-chat-security-risks" rel="noopener noreferrer"&gt;Security Risks of &lt;code&gt;--trust-all-tools&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-chat.html" rel="noopener noreferrer"&gt;List of Native Amazon Q Tools&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Multi-Stage Mode = Safer Generations&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Enable the &lt;code&gt;--multi-stage&lt;/code&gt; mode to break the generation process into two phases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Plan&lt;/strong&gt; – Preview changes or file content&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execute&lt;/strong&gt; – Approve or edit before committing to the file system&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is especially helpful for generating multiple files or sensitive infrastructure code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Q as a Live Coding Assistant&lt;/strong&gt;&lt;br&gt;
Instead of relying on tools like Amazon Q to write code for you, try using them to teach you how to write it. Think of it like having training wheels while you explore new technologies—guiding you through best practices as you build real-world solutions.&lt;br&gt;
Amazon Q can work like a context-aware CLI chatbot. Try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat Dockerfile | q "Explain and optimize this for production"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudformation describe-stacks | q "Summarize this output and point out misconfigurations"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Think of &lt;code&gt;CONFIG&lt;/code&gt;like an Extensible Prompt Library&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can easily add new file types by updating the &lt;code&gt;CONFIG&lt;/code&gt; dictionary—no need to change the Python logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experiment Freely, then Edit&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Because Q’s output is saved locally, you can iterate on your config until it meets your standards. You own the final version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🙏 Thank You!&lt;/strong&gt;&lt;br&gt;
Working on this project was a lot of fun, not just for the competition, but for the love of building and experimenting. I genuinely enjoyed every step, especially discovering how powerful Amazon Q can be. I didn’t expect such outstanding results from it, and I’m excited to keep exploring what it can do.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>awschallenge</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
