重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
rds by itsmostafa/aws-agent-skills
npx skills add https://github.com/itsmostafa/aws-agent-skills --skill rdsAmazon Relational Database Service (RDS) 提供托管的关係型数据库服务,包括 MySQL、PostgreSQL、MariaDB、Oracle、SQL Server 和 Aurora。RDS 负责配置、打补丁、备份和故障转移。
| 类别 | 示例 | 使用场景 |
|---|---|---|
| 标准型 | db.m6g.large | 通用用途 |
| 内存优化型 | db.r6g.large | 高内存负载 |
| 可突增型 | db.t3.medium | 可变负载,开发/测试 |
| 类型 | IOPS | 使用场景 |
|---|---|---|
| gp3 | 3,000-16,000 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 大多数工作负载 |
| io1/io2 | 最高 256,000 | 高性能 OLTP |
| magnetic | N/A | 旧版,避免使用 |
用于读取扩展的异步副本。支持跨区域。
AWS CLI:
# 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:
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
)
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
aws rds create-db-snapshot \
--db-snapshot-identifier my-postgres-snapshot-2024-01-15 \
--db-instance-identifier my-postgres
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
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
# 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
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'
)
| 命令 | 描述 |
|---|---|
aws rds create-db-instance | 创建实例 |
aws rds describe-db-instances | 列出实例 |
aws rds modify-db-instance | 修改设置 |
aws rds delete-db-instance | 删除实例 |
aws rds reboot-db-instance | 重启实例 |
aws rds start-db-instance | 启动已停止的实例 |
aws rds stop-db-instance | 停止实例 |
| 命令 | 描述 |
|---|---|
aws rds create-db-snapshot | 手动快照 |
aws rds describe-db-snapshots | 列出快照 |
aws rds restore-db-instance-from-db-snapshot | 从快照恢复 |
aws rds restore-db-instance-to-point-in-time | 时间点恢复 |
aws rds copy-db-snapshot | 复制快照 |
| 命令 | 描述 |
|---|---|
aws rds create-db-instance-read-replica | 创建只读副本 |
aws rds promote-read-replica | 提升为独立实例 |
切勿公开访问 — 使用 VPC 和安全组
启用静态加密 (KMS) 和传输中加密 (SSL)
使用 IAM 身份验证 进行应用程序访问
将凭据存储在 Secrets Manager 中并启用轮换
使用参数组 强制使用 SSL
aws rds modify-db-parameter-group
--db-parameter-group-name my-pg-params
--parameters "ParameterName=rds.force_ssl,ParameterValue=1,ApplyMethod=pending-reboot"
原因:
调试:
# 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
调试:
# 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
解决方案:
症状: 实例变得不可用
预防:
# 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
监控:
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
原因:
每周安装数
51
代码库
GitHub 星标数
1.1K
首次出现
2026年1月22日
安全审计
安装于
codex44
opencode44
gemini-cli43
cursor42
claude-code40
antigravity35
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.
| Category | Example | Use Case |
|---|---|---|
| Standard | db.m6g.large | General purpose |
| Memory Optimized | db.r6g.large | High memory workloads |
| Burstable | db.t3.medium | Variable workloads, dev/test |
| Type | IOPS | Use Case |
|---|---|---|
| gp3 | 3,000-16,000 | Most workloads |
| io1/io2 | Up to 256,000 | High-performance OLTP |
| magnetic | N/A | Legacy, avoid |
Asynchronous copies for read scaling. Can be cross-region.
AWS CLI:
# 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:
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
)
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
aws rds create-db-snapshot \
--db-snapshot-identifier my-postgres-snapshot-2024-01-15 \
--db-instance-identifier my-postgres
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
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
# 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
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'
)
| Command | Description |
|---|---|
aws rds create-db-instance | Create instance |
aws rds describe-db-instances | List instances |
aws rds modify-db-instance | Modify settings |
aws rds delete-db-instance | Delete instance |
aws rds reboot-db-instance | Reboot instance |
aws rds start-db-instance |
| Command | Description |
|---|---|
aws rds create-db-snapshot | Manual snapshot |
aws rds describe-db-snapshots | List snapshots |
aws rds restore-db-instance-from-db-snapshot | Restore from snapshot |
aws rds restore-db-instance-to-point-in-time | Point-in-time restore |
aws rds copy-db-snapshot | Copy snapshot |
| Command | Description |
|---|---|
aws rds create-db-instance-read-replica | Create read replica |
aws rds promote-read-replica | Promote to standalone |
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
aws rds modify-db-parameter-group
--db-parameter-group-name my-pg-params
--parameters "ParameterName=rds.force_ssl,ParameterValue=1,ApplyMethod=pending-reboot"
Causes:
Debug:
# 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
Debug:
# 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:
Symptom: Instance becomes unavailable
Prevention:
# 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
Monitor:
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:
Weekly Installs
51
Repository
GitHub Stars
1.1K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
codex44
opencode44
gemini-cli43
cursor42
claude-code40
antigravity35
Supabase Postgres 最佳实践指南 - 8大类别性能优化规则与SQL示例
89,100 周安装
| Start stopped instance |
aws rds stop-db-instance | Stop instance |