鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

rds

提供托管的关系型数据库服务,支持多种数据库引擎的部署与管理,实现高可用架构、自动备份、读写分离及性能优化,适用于需要稳定可靠数据库支撑的应用场景。

数据库开发运维
访问 GitHub
文档Skills.MD
name
rds
description
AWS RDS relational database service for managed databases. Use when provisioning databases, configuring backups, managing replicas, troubleshooting connectivity, or optimizing performance.
last_updated
2026-01-07
doc_source
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/

AWS RDS

Amazon Relational Database Service (RDS) provides managed relational databases including MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, and Aurora. RDS handles provisioning, patching, backups, and failover.

Table of Contents

  • Core Concepts
  • Common Patterns
  • CLI Reference
  • Best Practices
  • Troubleshooting
  • References

Core Concepts

DB Instance Classes

CategoryExampleUse Case
Standarddb.m6g.largeGeneral purpose
Memory Optimizeddb.r6g.largeHigh memory workloads
Burstabledb.t3.mediumVariable workloads, dev/test

Storage Types

TypeIOPSUse Case
gp33,000-16,000Most workloads
io1/io2Up to 256,000High-performance OLTP
magneticN/ALegacy, avoid

Multi-AZ Deployments

  • Multi-AZ Instance: Synchronous standby in different AZ
  • Multi-AZ Cluster: One writer, two reader instances (Aurora-like)

Read Replicas

Asynchronous copies for read scaling. Can be cross-region.

Common Patterns

Create a PostgreSQL Instance

AWS CLI:

▼
bash
复制代码
# Create DB subnet group aws rds create-db-subnet-group \ --db-subnet-group-name my-db-subnet-group \ --db-subnet-group-description "Private subnets for RDS" \ --subnet-ids subnet-12345678 subnet-87654321 # Create security group (allow PostgreSQL from app) aws ec2 create-security-group \ --group-name rds-postgres-sg \ --description "RDS PostgreSQL access" \ --vpc-id vpc-12345678 aws ec2 authorize-security-group-ingress \ --group-id sg-rds12345 \ --protocol tcp \ --port 5432 \ --source-group sg-app12345 # Create RDS instance aws rds create-db-instance \ --db-instance-identifier my-postgres \ --db-instance-class db.t3.medium \ --engine postgres \ --engine-version 16.1 \ --master-username admin \ --master-user-password 'SecurePassword123!' \ --allocated-storage 100 \ --storage-type gp3 \ --db-subnet-group-name my-db-subnet-group \ --vpc-security-group-ids sg-rds12345 \ --multi-az \ --backup-retention-period 7 \ --storage-encrypted \ --no-publicly-accessible

boto3:

▼
python
复制代码
import boto3 rds = boto3.client('rds') response = rds.create_db_instance( DBInstanceIdentifier='my-postgres', DBInstanceClass='db.t3.medium', Engine='postgres', EngineVersion='16.1', MasterUsername='admin', MasterUserPassword='SecurePassword123!', AllocatedStorage=100, StorageType='gp3', DBSubnetGroupName='my-db-subnet-group', VpcSecurityGroupIds=['sg-rds12345'], MultiAZ=True, BackupRetentionPeriod=7, StorageEncrypted=True, PubliclyAccessible=False )

Create Read Replica

▼
bash
复制代码
aws rds create-db-instance-read-replica \ --db-instance-identifier my-postgres-replica \ --source-db-instance-identifier my-postgres \ --db-instance-class db.t3.medium \ --availability-zone us-east-1b

Take a Snapshot

▼
bash
复制代码
aws rds create-db-snapshot \ --db-snapshot-identifier my-postgres-snapshot-2024-01-15 \ --db-instance-identifier my-postgres

Restore from Snapshot

▼
bash
复制代码
aws rds restore-db-instance-from-db-snapshot \ --db-instance-identifier my-postgres-restored \ --db-snapshot-identifier my-postgres-snapshot-2024-01-15 \ --db-instance-class db.t3.medium \ --db-subnet-group-name my-db-subnet-group \ --vpc-security-group-ids sg-rds12345

Point-in-Time Recovery

▼
bash
复制代码
aws rds restore-db-instance-to-point-in-time \ --source-db-instance-identifier my-postgres \ --target-db-instance-identifier my-postgres-pitr \ --restore-time 2024-01-15T10:30:00Z \ --db-instance-class db.t3.medium

Modify Instance

▼
bash
复制代码
# Change instance class (with downtime) aws rds modify-db-instance \ --db-instance-identifier my-postgres \ --db-instance-class db.m6g.large \ --apply-immediately # Scale storage (no downtime) aws rds modify-db-instance \ --db-instance-identifier my-postgres \ --allocated-storage 200 \ --apply-immediately

Connect with IAM Authentication

▼
python
复制代码
import boto3 import psycopg2 rds = boto3.client('rds') # Generate auth token token = rds.generate_db_auth_token( DBHostname='my-postgres.abc123.us-east-1.rds.amazonaws.com', Port=5432, DBUsername='iam_user', Region='us-east-1' ) # Connect conn = psycopg2.connect( host='my-postgres.abc123.us-east-1.rds.amazonaws.com', port=5432, database='mydb', user='iam_user', password=token, sslmode='require' )

CLI Reference

Instance Management

CommandDescription
aws rds create-db-instanceCreate instance
aws rds describe-db-instancesList instances
aws rds modify-db-instanceModify settings
aws rds delete-db-instanceDelete instance
aws rds reboot-db-instanceReboot instance
aws rds start-db-instanceStart stopped instance
aws rds stop-db-instanceStop instance

Backups

CommandDescription
aws rds create-db-snapshotManual snapshot
aws rds describe-db-snapshotsList snapshots
aws rds restore-db-instance-from-db-snapshotRestore from snapshot
aws rds restore-db-instance-to-point-in-timePoint-in-time restore
aws rds copy-db-snapshotCopy snapshot

Replicas

CommandDescription
aws rds create-db-instance-read-replicaCreate read replica
aws rds promote-read-replicaPromote to standalone

Best Practices

Security

  • Never make publicly accessible — use VPC and security groups
  • Enable encryption at rest (KMS) and in transit (SSL)
  • Use IAM authentication for application access
  • Store credentials in Secrets Manager with rotation
  • Use parameter groups to enforce SSL
▼
bash
复制代码
# Enforce SSL in PostgreSQL aws rds modify-db-parameter-group \ --db-parameter-group-name my-pg-params \ --parameters "ParameterName=rds.force_ssl,ParameterValue=1,ApplyMethod=pending-reboot"

Performance

  • Right-size instances — monitor CPU, memory, IOPS
  • Use gp3 for cost-effective performance
  • Enable Performance Insights for query analysis
  • Use read replicas for read scaling
  • Optimize queries — check slow query log

High Availability

  • Enable Multi-AZ for production
  • Use Aurora for mission-critical workloads
  • Configure appropriate backup retention
  • Test failover periodically
  • Monitor replication lag for replicas

Cost Optimization

  • Use Reserved Instances for steady-state workloads
  • Stop dev/test instances when not in use
  • Delete old snapshots regularly
  • Right-size instance classes

Troubleshooting

Cannot Connect

Causes:

  1. Security group not allowing access
  2. Instance not in VPC subnet
  3. SSL required but not used
  4. Wrong endpoint/port

Debug:

▼
bash
复制代码
# Check security group aws ec2 describe-security-groups --group-ids sg-rds12345 # Check instance status aws rds describe-db-instances \ --db-instance-identifier my-postgres \ --query "DBInstances[0].{Status:DBInstanceStatus,Endpoint:Endpoint}" # Test connectivity from EC2 nc -zv my-postgres.abc123.us-east-1.rds.amazonaws.com 5432

High CPU/Memory

Debug:

▼
bash
复制代码
# Enable Enhanced Monitoring aws rds modify-db-instance \ --db-instance-identifier my-postgres \ --monitoring-interval 60 \ --monitoring-role-arn arn:aws:iam::123456789012:role/rds-monitoring-role # Enable Performance Insights aws rds modify-db-instance \ --db-instance-identifier my-postgres \ --enable-performance-insights \ --performance-insights-retention-period 7

Solutions:

  • Scale up instance class
  • Optimize slow queries
  • Add read replicas
  • Check for locking/blocking

Storage Full

Symptom: Instance becomes unavailable

Prevention:

▼
bash
复制代码
# Enable storage autoscaling aws rds modify-db-instance \ --db-instance-identifier my-postgres \ --max-allocated-storage 500 # Set CloudWatch alarm aws cloudwatch put-metric-alarm \ --alarm-name "RDS-Storage-Low" \ --metric-name FreeStorageSpace \ --namespace AWS/RDS \ --dimensions Name=DBInstanceIdentifier,Value=my-postgres \ --statistic Average \ --period 300 \ --threshold 10000000000 \ --comparison-operator LessThanThreshold \ --evaluation-periods 2 \ --alarm-actions arn:aws:sns:us-east-1:123456789012:alerts

Replication Lag

Monitor:

▼
bash
复制代码
aws cloudwatch get-metric-statistics \ --namespace AWS/RDS \ --metric-name ReplicaLag \ --dimensions Name=DBInstanceIdentifier,Value=my-postgres-replica \ --start-time $(date -d '1 hour ago' -u +%Y-%m-%dT%H:%M:%SZ) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \ --period 60 \ --statistics Average

Causes:

  • Replica instance too small
  • Heavy write load
  • Network issues
  • Long-running queries on replica

References

  • RDS User Guide
  • RDS API Reference
  • RDS CLI Reference
  • boto3 RDS
数据库
开发运维

快捷安装

复制到终端去安装 Skill

npxskillsadditsmostafa/aws-agent-skills--skill"rds"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
retrieving-developer-knowledge
retrieving-developer-knowledge 用于搜索、获取和整合 Google 官方开发者文档,覆盖 Google Cloud、AI/Gemini、Android、Chrome、Web、Flutter、Go、Firebase 等平台,适用于查询 gcloud CLI 命令、API 语法、IAM 权限或架构对比等场景。
diff-intake
diff-intake 读取 PR 或分支差异,生成结构化 YAML 变更摘要,用于下游 analytics instrumentation 技能。适用于用户提交 PR 链接、分支对比或原始 diff 后需理解变更内容、评估分析覆盖或启动埋点流程的场景。
load-balancer-configurator
根据用户需求自动生成各类负载均衡器的生产级配置,覆盖 ALB、NLB、Nginx 和 HAProxy 等主流类型,适配不同协议、端口、健康检查及后端服务拓扑,支持直接集成到基础设施即代码流程中。
implement
实现 Linus Dashboard 的功能开发与集成,基于 TypeScript 和 Python 构建前后端组件,遵循严格的代码规范与架构模式,完成视图、卡片、服务及传感器等模块的创建与验证,确保高质量交付并兼容 Home Assistant 生态。
cloud-scheduler-job-creator
自动处理 Google Cloud Platform 中的云调度任务创建,提供符合最佳实践的配置方案与生产级代码生成,支持计算、存储、大数据及机器学习服务的集成部署。