You’re staring at a blank Lambda function, trying to remember the exact boto3 syntax for writing to DynamoDB. It’s a familiar frustration. Amazon Code Whisperer exists to kill that friction. It’s an AI coding companion from AWS that suggests whole lines, functions, and even security fixes as you type. But knowing it exists and using it well are two different things. This guide walks you through the practical steps, from installation to advanced tricks, with real examples you can try today.
Amazon Code Whisperer, which AWS now offers as part of Amazon Q Developer, is an AI programming assistant built for AWS. It’s trained on billions of lines of code, including a heavy dose of AWS SDKs and APIs, so it often feels like it’s reading your mind when you’re working with services like S3, DynamoDB, or Lambda.
Setting Up Amazon Code Whisperer in Your IDE
Before you can enjoy those magic suggestions, you need to get it running. The setup takes about five minutes.
Choose your IDE
Code Whisperer supports popular editors: VS Code, JetBrains IDEs (IntelliJ, PyCharm, etc.), AWS Cloud9, and the AWS Lambda console. Pick whichever you already use. For this guide, I’ll assume VS Code.
Install and authenticate
- Open VS Code and go to the Extensions marketplace. Search for “AWS Toolkit” – Code Whisperer is bundled inside it.
- Install the AWS Toolkit extension.
- Once installed, open the AWS panel (look for the AWS icon in the sidebar).
- Click “Connect to AWS” and choose “AWS Builder ID” for free access. You can also use IAM Identity Center if your company uses it.
- Follow the browser prompt to sign in or create a Builder ID. That’s it – you’re authenticated.
You’ll see a small Code Whisperer icon in the status bar. When it’s active, it will start suggesting code automatically.
Your First Suggestion: A Simple S3 Example
Let’s test it. Create a new Python file and type a comment that describes what you want:
# List all S3 buckets in my account
Press Enter. Within a second, Code Whisperer will suggest something like:
import boto3
s3 = boto3.client('s3')
response = s3.list_buckets()
for bucket in response['Buckets']:
print(bucket['Name'])
You can accept it by pressing Tab, or keep typing to ignore it. The suggestion appears in grey text, so it’s never intrusive.
That example is simple, but it shows the core workflow: write a comment, get code, press Tab.
Generating Infrastructure as Code with Code Whisperer
Where Code Whisperer really shines is with AWS-specific tasks. Say you need a CloudFormation template for an S3 bucket with versioning enabled. Instead of digging through docs, type this comment in a YAML file:
# CloudFormation template for an S3 bucket with versioning and encryption
Code Whisperer will generate the full template, including the Resources section, bucket properties, and even the VersioningConfiguration and BucketEncryption blocks. You’ll still need to review it, but it saves you from syntax errors and forgotten properties.
Lambda functions
Writing a Lambda handler that processes DynamoDB streams? Start with a comment like:
# Lambda function to process DynamoDB stream events and send to SQS
It will suggest the handler signature, the event parsing loop, and the SQS client setup. You can then tweak the business logic. This is especially handy when you’re using an unfamiliar AWS service – Code Whisperer often knows the API better than you do.
Security Scans and Reference Tracking
Code Whisperer isn’t just about speed. It also includes a security scanner that flags vulnerabilities as you write. You can run it manually from the AWS Toolkit panel or set it to scan on save.
Common issues it catches include:
- Hardcoded AWS credentials or API keys.
- SQL injection risks in database queries.
- Insecure deserialization.
- Missing encryption for S3 buckets or DynamoDB tables.
- Overly permissive IAM policies.
The reference tracker is another useful feature. If a suggestion matches open-source code, it will tell you the license and repository. That helps you avoid accidentally copying code with a restrictive license.
Tips for Getting Better Suggestions
Like any AI assistant, the quality of output depends on the quality of input. Here are a few habits that make a big difference.
Write descriptive comments
The more specific your comment, the better the suggestion. “Get data” is vague. “Get all items from DynamoDB table where status is ‘pending’ and sort by createdAt” will give you a much more accurate starting point.
Break down complex tasks
If you need a function that does five things, write five comments. Code Whisperer handles smaller chunks better. You can always combine the pieces later.
Use it for unfamiliar APIs
When you’re using a new AWS service, let Code Whisperer suggest the boilerplate. Then read the generated code to learn the correct method names and parameters. It’s like having a senior developer looking over your shoulder.
Keep it updated
AWS SDKs change. Make sure your extension and SDKs are current so suggestions reflect the latest APIs. The AI coding space is evolving quickly, and the latest tools and agents can handle more than just autocomplete.
When Code Whisperer Isn’t Enough
No tool is perfect. Code Whisperer sometimes suggests outdated patterns, especially for services that have recently changed. It can also struggle with complex business logic that isn’t well-represented in public code. And while it’s great at AWS, it’s less helpful for, say, a React frontend.
If you’re curious how it stacks up against GitHub Copilot, this comparison of what GitHub Copilot really does in 2025 is worth a read. And if you want to stay within the AWS ecosystem, AWS has been folding CodeWhisperer into Amazon Q Developer, which automates the worst parts of coding – like writing unit tests and debugging.
The key is to treat Code Whisperer as a productivity booster, not an autopilot. Always review suggestions before committing them.
A Mini Project: Building a Serverless URL Shortener
Let’s put everything together with a small project. You’ll build a serverless URL shortener using Lambda, API Gateway, and DynamoDB. Here’s how Code Whisperer helps at each step.
Step 1: Create the DynamoDB table. In a CloudFormation template, type # DynamoDB table for URL shortener with shortCode as partition key. Code Whisperer generates the table resource with the correct key schema.
Step 2: Write the Lambda function. Create a new Python file and comment: # Lambda function to shorten a URL. Accepts a long URL, generates a short code, stores in DynamoDB, returns the short URL. Code Whisperer will suggest a handler that uses uuid to generate a code, writes to DynamoDB, and returns a response. You’ll need to add your own error handling and validation, but the skeleton is there.
Step 3: Add the API Gateway trigger. In the Lambda console, add an API Gateway trigger. Code Whisperer can’t configure that for you, but it will suggest the correct event structure in your handler when you start parsing the request body.
Step 4: Run a security scan. Before deploying, run the security scan. It might flag that your Lambda function has overly broad permissions, or that your DynamoDB table isn’t encrypted. Fix those issues early.
Step 5: Deploy and test. Deploy the stack, test with a curl command, and iterate. With Code Whisperer, you’ve gone from blank slate to working prototype in a fraction of the time.
That’s the real value: it handles the boilerplate so you can focus on the parts that actually need your brain.

