Amazon Q 치트 시트
## 개요
Amazon Q는 지능형 코드 제안, 보안 스캔, 애플리케이션 현대화 기능을 제공하는 AWS의 AI 기반 코딩 어시스턴트입니다. 이는 인기 있는 IDE 및 AWS 서비스와 통합되어 컨텍스트 인식 추천 및 자동화된 코드 생성으로 개발자 생산성을 향상시킵니다.
⚠️ 참고: AWS 계정 및 적절한 IAM 권한이 필요합니다. 일부 기능은 Amazon Q 구독이 필요합니다.
설치 및 설정
VS Code 확장 프로그램
JetBrains IDE
AWS CLI 통합
인증
초기 설정
AWS Builder ID (무료)
프로페셔널 티어
핵심 기능
코드 완성
채팅 인터페이스
보안 스캔
명령줄 사용
Amazon Q CLI (미리보기)
AWS CLI 통합
IDE 통합
VS Code 명령
IntelliJ/PyCharm 명령
코드 생성 예시
함수 생성
API 엔드포인트 생성
단위 테스트 생성
애플리케이션 현대화
코드 변환
언어 마이그레이션
프레임워크 업그레이드
Note: Since no specific content was provided for the numbered sections (3-20), I’ve left placeholders in Korean. If you provide the specific text for those sections, I’ll be happy to translate them precisely.```bash
Install Amazon Q extension from VS Code marketplace
code —install-extension AmazonWebServices.amazon-q-vscode
Alternative: Search “Amazon Q” in Extensions tab
### JetBrains IDEs
```bash
# Install via JetBrains Plugin Repository
# File > Settings > Plugins > Marketplace
# Search "Amazon Q" and install
AWS CLI Integration
# 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
Authentication
Initial Setup
# 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 (Free)
# Create free AWS Builder ID account
# Provides basic code suggestions
# Limited monthly usage
Professional Tier
# Requires AWS subscription ($20/month per user)
# Advanced features including:
# - Security scanning
# - Code explanations
# - Unit test generation
# - Application modernization
Core Features
Code Completion
# 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
Chat Interface
# 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"
Security Scanning
# 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"
Command Line Usage
Amazon Q CLI (Preview)
# 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
AWS CLI Integration
# 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"
IDE Integration
VS Code Commands
# 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
IntelliJ/PyCharm Commands
# 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"
Code Generation Examples
Function Generation
// Type comment and let Amazon Q generate
// Function to validate email address
function validateEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
API Endpoint Creation
# 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
Unit Test Generation
// 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);
});
});
Application Modernization
Code Transformation
# Transform legacy code to modern frameworks
# Select code block
# Right-click > "Transform with Amazon Q"
# Choose target framework (React, Vue, Angular, etc.)
Language Migration
# Convert between programming languages
# Select code in source language
# Ask Amazon Q: "Convert this Java code to Python"
# Review and accept suggestions
Framework Upgrades
# 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
```### 취약점 탐지
```bash
# Get security recommendations
# Ask Amazon Q: "How to secure this API endpoint?"
# Receive suggestions for:
# - Input validation
# - Authentication
# - Authorization
# - Data encryption
```### 보안 모범 사례
```bash
# Check code against compliance standards
# OWASP Top 10
# CWE (Common Weakness Enumeration)
# AWS security best practices
```### 규정 준수 스캔
```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"
```## 고급 기능
```bash
# Amazon Q analyzes entire workspace
# Understands project structure
# Provides context-aware suggestions
# Maintains consistency across files
```### 맞춤형 프롬프트
```bash
# Generate AWS infrastructure code
# Ask: "Create Lambda function with API Gateway"
# Get CloudFormation/CDK templates
# Deploy directly to 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
```### AWS 서비스와 통합
```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
```## 문제 해결
```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
```### 일반적인 문제
```bash
# Write descriptive comments for better suggestions
# Use meaningful variable names
# Provide context in chat queries
# Review suggestions before accepting
# Test generated code thoroughly
```### 성능 최적화
```bash
# Review security scan results
# Don't ignore vulnerability warnings
# Validate input in generated code
# Follow principle of least privilege
# Regularly update dependencies
```### 디버깅
```bash
# Share useful prompts with team
# Establish coding standards
# Review AI-generated code
# Document custom configurations
# Train team on effective usage
```## 모범 사례
```bash
# Features included:
# - Basic code completion
# - Limited chat interactions
# - Security scanning (basic)
# - Monthly usage limits apply
```### 효과적인 사용법
```bash
# Additional features:
# - Advanced code generation
# - Unlimited chat
# - Application modernization
# - Priority support
# - Team management features
```### 보안 고려사항
```bash
# Custom pricing for:
# - SSO integration
# - Advanced security controls
# - Audit logging
# - Custom model training
# - Dedicated support
```### 팀 협업
https://docs.aws.amazon.com/amazonq/#
# 가격 및 제한
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode##
# 무료 티어 (AWS Builder ID)
https://plugins.jetbrains.com/plugin/24267-amazon-q##
# 프로페셔널 티어 ($20/월)
https://forums.aws.amazon.com/forum.jspa?forumID=293##
# 엔터프라이즈 기능
[Stack Overflow](https://stackoverflow.com/questions/tagged/amazon-q)
### 교육
- [AWS 교육 및 인증](https://aws.amazon.com/training/)
- [Amazon Q 워크샵](https://workshops.aws/)
- [개발자 가이드](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/)