Configure RDS database connection
✓Works with OpenClaudeYou are an AWS cloud infrastructure engineer. The user wants to configure and establish a connection to an Amazon RDS database instance.
What to check first
- Run
aws ec2 describe-security-groupsto verify your security group exists and has inbound rules for port 3306 (MySQL/MariaDB), 5432 (PostgreSQL), or 1433 (SQL Server) - Run
aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier,Endpoint.Address,Engine]'to list existing RDS instances and their endpoints
Steps
- Create an RDS instance using
aws rds create-db-instance --db-instance-identifier mydbinstance --db-instance-class db.t3.micro --engine mysql --master-username admin --master-user-password YourPassword123 --allocated-storage 20 - Wait for the instance to reach "available" status with
aws rds describe-db-instances --db-instance-identifier mydbinstance --query 'DBInstances[0].DBInstanceStatus' - Retrieve the RDS endpoint from
aws rds describe-db-instances --db-instance-identifier mydbinstance --query 'DBInstances[0].Endpoint.Address' - Create or modify the security group to allow inbound traffic on the database port from your application's security group using
aws ec2 authorize-security-group-ingress --group-id sg-xxxxx --protocol tcp --port 3306 --source-security-group-id sg-yyyyy - Install the database client tool locally:
mysql-client,psql, orsqlcmddepending on your engine type - Test the connection using the endpoint, username, and password you configured
- Store credentials securely in AWS Secrets Manager with
aws secretsmanager create-secret --name rds/mydb/credentials --secret-string '{"username":"admin","password":"YourPassword123"}' - Update your application connection string to use the RDS endpoint and retrieve credentials from Secrets Manager at runtime
Code
import boto3
import pymysql
from botocore.exceptions import ClientError
import json
def setup_rds_connection(db_instance_id, secret_name, region='us-east-1'):
"""
Retrieve RDS endpoint and credentials from AWS Secrets Manager,
then establish database connection.
"""
rds_client = boto3.client('rds', region_name=region)
secrets_client = boto3.client('secretsmanager', region_name=region)
try:
# Get RDS instance endpoint
rds_response = rds_client.describe_db_instances(
DBInstanceIdentifier=db_instance_id
)
db_endpoint = rds_response['DBInstances'][0]['Endpoint']['Address']
db_port = rds_response['DBInstances'][0]['Endpoint']['Port']
db_
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Cloud (AWS/GCP/Azure) Skills
Other Claude Code skills in the same category — free to download.
Lambda Function
Create AWS Lambda function with handler
S3 Operations
Set up S3 bucket operations (upload, download, presigned URLs)
DynamoDB CRUD
Create DynamoDB CRUD operations
SQS Setup
Set up SQS queue producer and consumer
SNS Notifications
Configure SNS for push notifications
CloudFront Setup
Set up CloudFront CDN distribution
Cognito Auth
Implement AWS Cognito authentication
ECS Task Definition
Create ECS task definitions
Want a Cloud (AWS/GCP/Azure) skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.