The PlanetScale Discovery CLI can analyze AWS RDS instances, Aurora clusters, and related networking infrastructure.
- AWS account with RDS/Aurora instances
- AWS credentials configured (IAM user, role, or profile)
- Python package:
pip install "ps-discovery[aws]"
The cloud discovery feature requires access to the following AWS services:
- Amazon RDS - For analyzing RDS instances and Aurora clusters
- Amazon EC2 - For VPC, subnet, security group, and gateway analysis
- Amazon CloudWatch - For performance metrics and monitoring data
- AWS STS - For credential validation and cross-account access
Create an IAM policy with the following comprehensive permissions for complete infrastructure analysis:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PlanetScaleDiscoveryRDS",
"Effect": "Allow",
"Action": [
"rds:DescribeDBInstances",
"rds:DescribeDBClusters",
"rds:DescribeDBSubnetGroups",
"rds:DescribeDBClusterParameterGroups",
"rds:DescribeDBParameterGroups",
"rds:DescribeOptionGroups"
],
"Resource": "*"
},
{
"Sid": "PlanetScaleDiscoveryEC2",
"Effect": "Allow",
"Action": [
"ec2:DescribeVpcs",
"ec2:DescribeSubnets",
"ec2:DescribeSecurityGroups",
"ec2:DescribeInternetGateways",
"ec2:DescribeNatGateways",
"ec2:DescribeVpcEndpoints",
"ec2:DescribeRouteTables",
"ec2:DescribeNetworkAcls",
"ec2:DescribeVpcPeeringConnections",
"ec2:DescribeTransitGateways",
"ec2:DescribeVpnGateways"
],
"Resource": "*"
},
{
"Sid": "PlanetScaleDiscoveryCloudWatch",
"Effect": "Allow",
"Action": [
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics"
],
"Resource": "*"
},
{
"Sid": "PlanetScaleDiscoverySTS",
"Effect": "Allow",
"Action": [
"sts:GetCallerIdentity"
],
"Resource": "*"
}
]
}# Configure AWS CLI profile
aws configure --profile migration-discovery
# Use in discovery tool
ps-discovery cloud --aws-profile migration-discoveryOr in configuration file:
providers:
aws:
enabled: true
credentials:
profile: migration-discovery
regions:
- us-east-1
- us-west-2providers:
aws:
enabled: true
credentials:
role_arn: "arn:aws:iam::123456789012:role/PlanetScaleDiscoveryRole"
external_id: "unique-external-id" # Optional but recommended
regions:
- us-east-1export AWS_ACCESS_KEY_ID=your-access-key
export AWS_SECRET_ACCESS_KEY=your-secret-key
export AWS_DEFAULT_REGION=us-east-1
ps-discovery cloud --config config.yamlWhen running on EC2, the tool can automatically use the instance's IAM role. No additional configuration needed.
modules:
- cloud
providers:
aws:
enabled: true
regions:
- us-east-1
- us-west-2
discover_all: true
output:
output_dir: ./aws_discovery_outputproviders:
aws:
enabled: true
regions:
- us-east-1
discover_all: true
target_database: my-rds-instance # Focus on specific database
output:
output_dir: ./focused_discoveryproviders:
aws:
enabled: true
credentials:
role_arn: "arn:aws:iam::ACCOUNT-ID:role/DiscoveryRole"
external_id: "unique-id"
regions:
- us-east-1
- eu-west-1
discover_all: trueproviders:
aws:
enabled: true
discover_all: false
resources:
rds_instances:
- production-db-1
- staging-db-1
aurora_clusters:
- prod-cluster
regions:
- us-east-1-
Via AWS Console:
- Navigate to IAM → Policies → Create Policy
- Choose JSON tab and paste the permissions JSON above
- Name it
PlanetScaleDiscoveryPolicy - Click Create Policy
-
Via AWS CLI:
aws iam create-policy \ --policy-name PlanetScaleDiscoveryPolicy \ --policy-document file://discovery-policy.json
# Create trust policy file
cat > trust-policy.json << EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::YOUR-ACCOUNT:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "unique-external-id"
}
}
}
]
}
EOF
# Create the role
aws iam create-role \
--role-name PlanetScaleDiscoveryRole \
--assume-role-policy-document file://trust-policy.json
# Attach the policy
aws iam attach-role-policy \
--role-name PlanetScaleDiscoveryRole \
--policy-arn arn:aws:iam::YOUR-ACCOUNT:policy/PlanetScaleDiscoveryPolicy# Create user
aws iam create-user --user-name ps-discovery
# Attach policy
aws iam attach-user-policy \
--user-name ps-discovery \
--policy-arn arn:aws:iam::YOUR-ACCOUNT:policy/PlanetScaleDiscoveryPolicy
# Create access key
aws iam create-access-key --user-name ps-discoverySpecify multiple regions to analyze RDS instances across regions:
providers:
aws:
enabled: true
regions:
- us-east-1
- us-west-2
- eu-west-1
- ap-southeast-1If not specified, the tool defaults to us-east-1.
- CloudWatch API calls are charged per region
- RDS and EC2 describe calls are generally free
- For large-scale discovery, monitor AWS API costs
- Instance identifier and ARN
- Engine type and version
- Instance class and storage
- Multi-AZ configuration
- Backup retention and windows
- Maintenance windows
- Performance Insights status
- Enhanced monitoring
- Encryption status
- Cluster identifier and ARN
- Engine mode (provisioned/serverless)
- Reader/writer endpoints
- Cluster members
- Backup retention
- Global database configuration
- VPC configuration
- Subnet groups and availability zones
- Security groups and rules
- Route tables
- Internet gateways
- NAT gateways
- VPC peering connections
- Transit gateway attachments
- CloudWatch metrics
- CPU, memory, storage utilization
- Connection counts
- Replication lag (if applicable)
Problem: AWS credentials not found or invalid
Solutions:
- Verify AWS CLI is configured:
aws sts get-caller-identity - Check profile name matches configuration
- Ensure credentials have not expired
- For role assumption, verify trust policy
Problem: IAM permissions insufficient
Solutions:
- Verify IAM policy includes all required permissions
- Check region-specific permissions
- Confirm policy is attached to user/role
- Review AWS CloudTrail for specific denied actions
Problem: No RDS instances discovered
Solutions:
- Verify instances exist in specified regions
- Check region configuration
- Ensure credentials have rds:DescribeDBInstances permission
- Try with
discover_all: true
Problem: AWS API throttling
Solutions:
- Reduce number of regions
- Implement retry delays (built-in)
- Request rate limit increase from AWS
- Spread discovery over multiple time windows
- Use IAM roles instead of access keys when possible
- Rotate access keys regularly (90 days recommended)
- Never commit credentials to version control
- Use AWS Secrets Manager for credential storage
- Grant only required permissions
- Use resource-specific policies when possible
- Limit regions in IAM policies
- Review CloudTrail logs for unused permissions
- Enable CloudTrail logging for API calls
- Set up CloudWatch alarms for unusual API activity
- Review IAM Access Analyzer findings
- Periodic access review (quarterly recommended)
For AWS GovCloud or custom endpoints:
providers:
aws:
enabled: true
regions:
- us-gov-west-1
endpoint_url: https://rds.us-gov-west-1.amazonaws.comexport HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
export NO_PROXY=169.254.169.254 # For instance metadata
ps-discovery cloud --config config.yamlFor temporary credentials:
providers:
aws:
enabled: true
credentials:
access_key_id: ASIA...
secret_access_key: ...
session_token: IQoJb3...
regions:
- us-east-1- Document Multi-AZ deployments
- Review failover procedures
- Catalog current backup retention
- Evaluate point-in-time recovery needs
- Document VPC peering connections
- Review security group rules
- Baseline current performance metrics
- Identify workload patterns
For issues with AWS discovery:
- Report bugs: https://github.com/planetscale/ps-discovery/issues
- AWS Support: https://aws.amazon.com/support/