Amazon Q Folha de Dicas
Visão Geral
Amazon Q é o assistente de codificação com IA da AWS que fornece sugestões inteligentes de código, varredura de segurança e recursos de modernização de aplicações. Ele se integra com IDEs populares e serviços AWS para aumentar a produtividade do desenvolvedor com recomendações sensíveis ao contexto e geração automatizada de código.
⚠️ Nota: Requer conta AWS e permissões IAM apropriadas. Alguns recursos requerem assinatura do Amazon Q.
Instalação e Configuração
Extensão VS Code
# Install Amazon Q extension from VS Code marketplace
code --install-extension AmazonWebServices.amazon-q-vscode
# Alternative: Search "Amazon Q" in Extensions tab
IDEs JetBrains
# Install via JetBrains Plugin Repository
# File > Settings > Plugins > Marketplace
# Search "Amazon Q" and install
Integração AWS CLI
# Install AWS CLI v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
# Configure credentials
aws configure
Autenticação
Configuração Inicial
# Sign in through IDE extension
# Click "Sign in to Amazon Q" in IDE
# Choose authentication method:
# - AWS Builder ID (free tier)
# - IAM Identity Center
# - AWS credentials
AWS Builder ID (Gratuito)
# Create free AWS Builder ID account
# Provides basic code suggestions
# Limited monthly usage
Plano Profissional
# Requires AWS subscription ($20/month per user)
# Advanced features including:
# - Security scanning
# - Code explanations
# - Unit test generation
# - Application modernization
Recursos Principais
Conclusão de Código
# Automatic suggestions while typing
# Press Tab to accept suggestion
# Press Esc to dismiss suggestion
# Multi-line code generation
# Type comment describing function
# Amazon Q generates implementation
# Example:
# Type: "// Function to sort array of objects by name"
# Press Enter and Amazon Q suggests implementation
Interface de Chat
# Open chat panel in IDE
# Ask questions about code
# Request explanations
# Get help with debugging
# Example queries:
"Explain this function"
"How to optimize this code?"
"Write unit tests for this class"
"Convert this to TypeScript"
Varredura de Segurança
# Automatic security vulnerability detection
# Real-time scanning while coding
# Suggestions for security fixes
# Manual security scan
# Right-click in editor
# Select "Amazon Q: Scan for security issues"
Uso via Linha de Comando
Amazon Q CLI (Prévia)
# Install Amazon Q CLI
npm install -g @aws/amazon-q-cli
# Initialize in project
amazon-q init
# Ask questions
amazon-q ask "How to deploy this to AWS?"
# Generate code
amazon-q generate --prompt "Create REST API endpoint"
# Analyze code
amazon-q analyze --file src/main.js
Integração AWS CLI
# Use Amazon Q with AWS CLI
aws q ask "How to create S3 bucket with encryption?"
# Get help with AWS services
aws q explain ec2 describe-instances
# Troubleshoot AWS issues
aws q troubleshoot --service lambda --error "Function timeout"
Integração com IDEs
Comandos VS Code
# Command Palette (Ctrl+Shift+P)
"Amazon Q: Open Chat"
"Amazon Q: Explain Code"
"Amazon Q: Generate Unit Tests"
"Amazon Q: Optimize Code"
"Amazon Q: Security Scan"
"Amazon Q: Transform Code"
# Keyboard shortcuts
Ctrl+I # Inline code generation
Alt+C # Open chat
Ctrl+Shift+A # Explain selected code
Comandos IntelliJ/PyCharm
# Tools menu
Tools > Amazon Q > Open Chat
Tools > Amazon Q > Explain Code
Tools > Amazon Q > Generate Tests
# Context menu (right-click)
"Ask Amazon Q"
"Explain with Amazon Q"
"Generate tests with Amazon Q"
Exemplos de Geração de Código
Geração de Função
// Type comment and let Amazon Q generate
// Function to validate email address
function validateEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
Criação de Endpoint de API
# Generate Flask API endpoint
# POST endpoint to create user
@app.route('/users', methods=['POST'])
def create_user():
data = request.get_json()
user = User(
name=data['name'],
email=data['email']
)
db.session.add(user)
db.session.commit()
return jsonify({'id': user.id}), 201
Geração de Teste Unitário
// Generate Jest tests for function
describe('validateEmail', () => {
test('should return true for valid email', () => {
expect(validateEmail('test@example.com')).toBe(true);
});
test('should return false for invalid email', () => {
expect(validateEmail('invalid-email')).toBe(false);
});
});
Modernização de Aplicação
Transformação de Código
# Transform legacy code to modern frameworks
# Select code block
# Right-click > "Transform with Amazon Q"
# Choose target framework (React, Vue, Angular, etc.)
Migração de Linguagem
# Convert between programming languages
# Select code in source language
# Ask Amazon Q: "Convert this Java code to Python"
# Review and accept suggestions
Atualizações de Framework
Would you like me to continue with the remaining sections?```bash
Upgrade to newer framework versions
Ask Amazon Q: “Upgrade this React class component to hooks”
Get step-by-step migration guidance
```bash
# Automatic scanning for:
# - SQL injection vulnerabilities
# - Cross-site scripting (XSS)
# - Insecure dependencies
# - Hardcoded secrets
# - Authentication issues
```### Melhores Práticas de Segurança
```bash
# Get security recommendations
# Ask Amazon Q: "How to secure this API endpoint?"
# Receive suggestions for:
# - Input validation
# - Authentication
# - Authorization
# - Data encryption
```### Varredura de Conformidade
```bash
# Check code against compliance standards
# OWASP Top 10
# CWE (Common Weakness Enumeration)
# AWS security best practices
```## Recursos Avançados
```bash
# Create custom code generation prompts
# Define templates for common patterns
# Share prompts across team
# Example custom prompt:
"Generate CRUD operations for {entity} with validation and error handling"
```### Prompts Personalizados
```bash
# Amazon Q analyzes entire workspace
# Understands project structure
# Provides context-aware suggestions
# Maintains consistency across files
```### Contexto do Workspace
```bash
# Generate AWS infrastructure code
# Ask: "Create Lambda function with API Gateway"
# Get CloudFormation/CDK templates
# Deploy directly to AWS
```### Integração com Serviços AWS
```bash
# Extension not working
# Check AWS credentials configuration
# Verify internet connection
# Restart IDE
# No code suggestions
# Check if Amazon Q is enabled in settings
# Verify file type is supported
# Check subscription status
```## Solução de Problemas
```bash
# Improve suggestion speed
# Close unnecessary files
# Reduce workspace size
# Update to latest extension version
# Manage suggestion frequency
# Adjust settings in IDE preferences
# Configure trigger delay
# Set suggestion limits
```### Otimização de Desempenho
```bash
# View Amazon Q logs
# VS Code: View > Output > Amazon Q
# IntelliJ: Help > Show Log in Explorer
# Report issues
# Use "Send Feedback" in extension
# Include error logs and reproduction steps
```### Depuração
```bash
# Write descriptive comments for better suggestions
# Use meaningful variable names
# Provide context in chat queries
# Review suggestions before accepting
# Test generated code thoroughly
```## Melhores Práticas
```bash
# Review security scan results
# Don't ignore vulnerability warnings
# Validate input in generated code
# Follow principle of least privilege
# Regularly update dependencies
```### Considerações de Segurança
```bash
# Share useful prompts with team
# Establish coding standards
# Review AI-generated code
# Document custom configurations
# Train team on effective usage
```### Colaboração em Equipe
```bash
# Features included:
# - Basic code completion
# - Limited chat interactions
# - Security scanning (basic)
# - Monthly usage limits apply
```## Preços e Limites
```bash
# Additional features:
# - Advanced code generation
# - Unlimited chat
# - Application modernization
# - Priority support
# - Team management features
```### Plano Gratuito (AWS Builder ID)
```bash
# Custom pricing for:
# - SSO integration
# - Advanced security controls
# - Audit logging
# - Custom model training
# - Dedicated support
```### Plano Profissional ($20/mês)
https://docs.aws.amazon.com/amazonq/##
# Recursos Empresariais
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode#
# Recursos
https://plugins.jetbrains.com/plugin/24267-amazon-q##
# Documentação
- [Guia do Desenvolvedor Amazon Q](https://forums.aws.amazon.com/forum.jspa?forumID=293)
- [Extensão do VS Code](
)
- [Plugin JetBrains](
)
### Comunidade
- [Fóruns de Desenvolvedores AWS](
)
- [Problemas no GitHub](
)[Stack Overflow](https://stackoverflow.com/questions/tagged/amazon-q)
### Treinamento
- [AWS Training and Certification](https://aws.amazon.com/training/)
- [Amazon Q Workshops](https://workshops.aws/)
- [Guias de Desenvolvedor](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/)
The translations follow the specified rules:
- Preserved markdown formatting
- Kept technical terms in English
- Maintained original structure
- Translated content to Portuguese
- Kept the same numbered format