DEV Community

Cover image for What Your AWS and GCP Python Code Is Really Doing (I Built a VS Code Extension to Find Out)
Phaustin Karani
Phaustin Karani

Posted on

What Your AWS and GCP Python Code Is Really Doing (I Built a VS Code Extension to Find Out)

TL;DR: Python Code Mentor is the only VS Code extension that provides AI-powered explanations for AWS, Google Cloud, and multi-cloud Python code patterns. It goes beyond syntax highlighting to explain how serverless architectures actually behave in the real world.

The Problem with Current Code Analysis Tools

Most VS Code extensions are good at helping you write Python. Some go a step further and focus on a single cloud provider. But almost none of them explain what your cloud code is actually doing — or why it’s structured the way it is.

So you end up context-switching constantly:

  • Googling “how does Lambda work with S3”
  • Comparing Cloud Functions vs Lambda
  • Jumping between docs, Google AI Overviews, or ChatGPT just to understand why a Firestore query is slow

Instead of understanding the code in front of you, you’re stitching together mental models from AI summaries and documentation tabs.

That gap is what pushed me to build Python Code Mentor.

What Makes Python Code Mentor Different

1. Multi-Cloud Intelligence

This extension understands AWS and Google Cloud in the same codebase — something I couldn’t find in existing tools.

It automatically detects:

  • AWS patterns: Lambda handlers, boto3 calls, S3 and DynamoDB interactions
  • GCP patterns: Cloud Functions, Google Cloud SDK usage, Firestore and BigQuery operations
  • Mixed environments: Codebases that touch both clouds (very common in real-world systems)

When you select code, the extension knows whether you’re dealing with AWS Lambda or Google Cloud Functions and explains it in the right context.

No generic answers. No cloud-agnostic fluff.

2. Serverless Function Tracing

Most tools stop at syntax. This one focuses on execution.

AWS Lambda Example:

def lambda_handler(event, context):
    s3_client = boto3.client('s3')
    # Select this code, hit Ctrl+Shift+W
Enter fullscreen mode Exit fullscreen mode

Instead of a shallow explanation, the extension generates realistic S3 trigger events and walks through the function step-by-step:

  • how the event is structured,
  • how boto3 calls are executed,
  • what gets returned to AWS.

Google Cloud Functions Example:

@functions_framework.http
def process_request(request):
    db = firestore.Client()
    # Select this code, hit Ctrl+Alt+F
Enter fullscreen mode Exit fullscreen mode

Here, it simulates real HTTP requests and explains how Cloud Functions handle them — including cold starts, Firestore access, and response handling.

This is the kind of clarity you usually only get after deploying and debugging in production.

3. Cloud SDK Deep Dives

Instead of stopping at method signatures, Python Code Mentor explains what each cloud operation means in practice:

  • Cost implications: “This DynamoDB scan will cost $X per million items”
  • Performance impact: “This Firestore query isn’t indexed and will be slow”
  • Security considerations: “This S3 operation requires these IAM permissions”
  • Best practices: “Batch writes would be more efficient here”

It connects the dots between code, architecture, and real-world consequences.

4. Architecture Pattern Recognition

The extension recognizes and explains common cloud patterns:

  • Event-driven flows: S3 → Lambda → DynamoDB
  • Pub/Sub messaging: Cloud Functions triggered by Pub/Sub
  • Data pipelines: BigQuery → Cloud Functions → Cloud Storage
  • Multi-cloud sync: Moving data between AWS and GCP

Instead of guessing “what kind of system is this?”, the tool tells you.

Unique Features No Other Extension Has

Smart Context Switching

# AWS code
s3_client = boto3.client('s3')
dynamodb = boto3.resource('dynamodb')

# GCP code in same file
storage_client = storage.Client()
db = firestore.Client()
Enter fullscreen mode Exit fullscreen mode
  • Select the AWS section → AWS-specific explanations
  • Select the GCP section → GCP-specific explanations
  • Select both → a comparative breakdown of how the two clouds differ

This alone removes a ton of mental overhead.

Multi-Cloud Comparative Analysis

When both cloud patterns are detected, the extension provides insights like:

  • Why a team might use both S3 and Cloud Storage
  • How Lambda and Cloud Functions pricing models affect architecture
  • How DynamoDB and Firestore differ in transaction handling

It explains the why, not just the how.

Realistic Event Generation

Instead of toy examples, the extension generates events that closely match real deployments:

  • API Gateway events for HTTP Lambdas
  • S3 events for storage-triggered functions
  • Pub/Sub messages for message-driven Cloud Functions
  • Firestore triggers for database-driven logic

This makes tracing feel practical, not theoretical.

Cost and Performance Insights

Cloud mistakes are expensive. The extension helps surface them early:

  • Flags costly operations before deployment
  • Suggests optimizations based on real cloud behavior
  • Explains scaling implications of specific code paths

What Didn’t Work (and Took Way Longer Than Expected)

This part matters, because building this wasn’t smooth sailing.

Gemini API Was the Biggest Challenge

Integrating the Gemini API turned out to be far more complex than expected.

What I hoped would take a couple of days ended up taking nearly two full weeks.

Some of the issues:

  • Inconsistent response formats depending on prompt complexity
  • Rate limiting behaving differently than documented
  • Edge cases where responses were technically correct but unusable for code explanations
  • Multiple prompt iterations just to make explanations cloud-aware, not generic

A lot of time went into retry logic, fallbacks, and prompt tuning just to make the output reliable inside an editor.

Classic Developer Pain Points

Some other very common (and frustrating) issues:

  • VS Code API quirks: Things that work in one version silently fail in another
  • Command conflicts: Keybindings clashing with popular extensions
  • Performance tradeoffs: Making sure AI calls didn’t freeze the editor
  • Messy real-world code: Half-written functions, commented blocks, mixed styles
  • Expectation gaps: Users expect magic, but AI still needs guardrails

None of this is glamorous — but it’s the reality of building developer tools.

Technical Implementation

Built with Kiro IDE

Python Code Mentor was built using Kiro IDE, Amazon’s AI-powered development environment.

Kiro’s understanding of AWS patterns significantly accelerated development, especially for:

  • Rapid prototyping of cloud integrations
  • Automated testing of AWS service interactions
  • AI-powered code reviews
  • Generating documentation for complex workflows

For cloud-native tooling, it felt like the IDE was speaking the same language as the problem.

Pattern Detection Engine

// Automatically detects patterns like:
- /lambda_handler|event|context/ (AWS Lambda)
- /@functions_framework|functions_framework/ (GCP Cloud Functions)
- /boto3|aws_|s3|dynamodb/ (AWS SDK)
- /from google\.cloud|google\.cloud/ (Google Cloud SDK)
Enter fullscreen mode Exit fullscreen mode

Intelligent Routing

Detected code is routed to the correct analysis engine:

  • AWS-only → AWS-specific explanations
  • GCP-only → GCP-specific explanations
  • Mixed → Multi-cloud comparisons
  • Plain Python → Standard explanations

AI-Powered Explanations

Uses Google’s Gemini AI with cloud-aware prompts that understand:

  • Serverless execution models
  • Cloud service interactions
  • Pricing tradeoffs
  • Security best practices
  • Performance characteristics

Commands and Shortcuts

Core Python Features

  • Ctrl+Shift+E – Explain Python code
  • Ctrl+Shift+T – Trace execution
  • Ctrl+Shift+L – Analyze logic
  • Ctrl+Shift+Q – Generate quizzes

AWS Features

  • Ctrl+Shift+A – Explain AWS/Lambda code
  • Ctrl+Shift+W – Trace Lambda execution
  • Ctrl+Shift+B – boto3 deep dive

GCP Features

  • Ctrl+Alt+G – Explain GCP code
  • Ctrl+Alt+F – Trace Cloud Functions
  • Ctrl+Alt+S – Google Cloud SDK deep dive

Real-World Use Cases

Learning Cloud Patterns

Dropped into an unfamiliar serverless app? Select a function and understand the full event flow.

Multi-Cloud Migrations

Moving between AWS and GCP? Get side-by-side explanations of equivalent patterns.

Code Reviews

Quickly understand what cloud interactions do — and whether they follow best practices.

Debugging Production Issues

Trace realistic events to understand how failures propagate through your code.

Why This Matters for Modern Development

  • Multi-cloud is normal: Most teams use more than one provider
  • Serverless is everywhere: Event-driven code needs event-aware tools
  • Cloud costs are real: Understanding behavior saves money
  • The learning curve is steep: This tool focuses on the why, not just the what

Installation and Setup

Python Code Mentor is available on both major extension registries:

Setup:

  1. Install the extension
  2. Get a free Google Gemini API key
  3. Add the key in VS Code settings
  4. Start selecting cloud code

No cloud credentials required.

The Bottom Line

Python Code Mentor is built for people who actually run Python in the cloud.

It:

  • Understands AWS and Google Cloud patterns
  • Traces real serverless execution
  • Explains cost and performance tradeoffs
  • Handles multi-cloud codebases intelligently
  • Teaches architecture, not just syntax

If you write cloud-based Python, this extension turns your editor into a learning tool — not just a text box.

Availability: VS Code Marketplace & Open VSX
Requirements: VS Code 1.85.0+, Google Gemini API key (free)
Pricing: Freemium — 20 free requests/day, unlimited with PRO license

Top comments (0)