What's Happening
AWS RDS access works in two layers — the IAM level controls who can manage the database instance itself, while the database level controls what SQL commands users can run inside it.
Think of it like a building with two security checkpoints. The first gate (IAM) decides who gets into the parking lot, while the second gate (database) decides which rooms they can enter inside the building. If either gate isn't configured right, you'll hit "access denied" errors even when everything looks green in the console.
Here's the thing: most access issues come from mismatched permissions between these two layers. Always double-check both before troubleshooting.
Can I give someone access without creating an IAM policy?
No, you'll need an IAM policy for AWS-level access — database-level permissions alone aren't enough for AWS management actions.
Now, here's a common workaround: if you just need someone to run SQL queries (not manage the RDS instance itself), you can skip the IAM policy and go straight to creating a database user. But honestly, this is risky — anyone with database access could still spin up or delete your instance if they get their hands on the master credentials. Better to keep both layers secured.
What permissions should I grant?
Start with the principle of least privilege — only grant the specific actions needed for the user's role.
For most applications, that means:
- For read-only access:
SELECT permissions only
- For CRUD operations:
SELECT, INSERT, UPDATE, DELETE
- For schema changes:
CREATE, ALTER, DROP (use sparingly!)
That said, don't overcomplicate it at first. You can always tighten permissions later once you see what the user actually needs to do.
How do I restrict access to specific IP addresses?
Adjust your RDS security group to allow traffic only from trusted IP ranges — this happens at the network level, not in IAM.
Here's how:
- Go to the VPC console → Security Groups
- Find your RDS security group (usually has "rds" in the name)
- Add an inbound rule for your database port (3306 for MySQL, 5432 for PostgreSQL)
- Set the source to your specific IP range (e.g., 203.0.113.0/24) or a specific IP (203.0.113.5/32)
Pro tip: If you're using AWS services like Lambda or EC2, reference their security groups instead of IP addresses for more flexibility.
What's the difference between IAM authentication and password authentication?
IAM authentication uses temporary tokens instead of passwords — they're valid for just 15 minutes and rotate automatically.
Why bother? Three big reasons:
- No password management — you don't need to rotate credentials quarterly
- Stronger security — tokens are short-lived and can't be reused
- Easier auditing — every login is tied to a specific IAM identity
That said, not all applications support IAM auth yet. Check the AWS documentation for your specific database engine.
Can I give access to an external service like a SaaS tool?
Yes, but you'll need to create a dedicated database user and share credentials carefully — never use your master credentials.
Here's the safest approach:
- Create a database user with only the permissions the SaaS tool needs
- Generate a strong password (or better, use IAM auth if supported)
- Share the credentials through a secure channel (encrypted email, password manager, or AWS Secrets Manager)
- Rotate the password immediately if the SaaS provider no longer needs access
Honestly, this is where most security breaches start. Treat external service credentials like you would your own — with extreme care.
What if I need to give temporary access?
Create a temporary IAM user with an expiration date — AWS lets you set a specific end date for user credentials.
Here's how to make it truly temporary:
- Create a new IAM user with a name indicating its temporary nature (e.g., "temp-contractor-2024-06")
- Set an explicit end date in the user's description field
- Attach the minimal necessary permissions
- Schedule a calendar reminder to delete the user when the work is done
For database access, you can also temporarily grant elevated permissions knowing you'll revoke them later. Just don't forget!
How do I give access to an EC2 instance?
Attach an IAM role to the EC2 instance with RDS access permissions — this is cleaner than using access keys.
Two approaches work here:
- IAM Role Method (Recommended):
- Create an IAM role with the RDS access policy
- Attach it to your EC2 instance
- Applications on the instance can then access RDS without storing credentials
- Security Group Method:
- Ensure the EC2 instance's security group allows outbound traffic to your RDS security group
- Applications can then connect using standard database credentials
Between these two, the IAM role method is generally more secure and easier to manage.
What's the fastest way to grant access?
For immediate needs, create a database user with broad permissions first — you can tighten security later.
When you're in a hurry:
- Connect to your RDS instance using your master credentials
- Run the appropriate
CREATE USER and GRANT ALL PRIVILEGES command for your database
- Share the new credentials with the person needing access
- Come back later to implement proper least-privilege permissions
Just remember: broad permissions are a security risk. Don't leave them in place longer than necessary.
How do I revoke access when someone no longer needs it?
Delete the IAM policy attachment and the database user — both layers need cleanup.
Complete revocation takes two steps:
- IAM Cleanup:
- Detach the RDS access policy from the user/role
- Delete the policy if it's no longer needed by anyone else
- Database Cleanup:
- Connect to your RDS instance
- Run
DROP USER username; (MySQL) or DROP ROLE username; (PostgreSQL)
Set a calendar reminder to verify the access is truly gone — it's easy to miss one of these steps.
Can I give access to multiple databases on the same RDS instance?
Yes, but you'll need to specify the database name in the GRANT statements — each user can have different permissions per database.
For example, with MySQL:
GRANT SELECT ON database1.* TO 'user1'@'%';
GRANT ALL PRIVILEGES ON database2.* TO 'user2'@'%';
PostgreSQL works similarly:
GRANT USAGE ON SCHEMA public TO user1;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO user1;
This approach lets you segment access by database function or team.
What if my RDS is in a private subnet?
You'll need to set up VPC peering, VPN, or AWS Direct Connect — private subnets block all external access by default.
Three common solutions:
- Bastion Host:
- Create an EC2 instance in a public subnet
- Use it as a jump box to access your RDS
- Restrict SSH access to your IP range only
- AWS VPN:
- Set up a site-to-site VPN connection
- Route traffic from your on-premises network to RDS
- VPC Peering:
- Create a peering connection between VPCs
- Update route tables to allow traffic
Bastion hosts are generally the quickest to set up for temporary access.
How do I give access to an AWS Lambda function?
Attach an IAM role with RDS access to the Lambda function — this is the cleanest approach.
Here's the step-by-step:
- Create an IAM role with the RDS access policy
- Attach the role to your Lambda function
- Configure your Lambda function to use IAM authentication (recommended) or store database credentials in AWS Secrets Manager
- Ensure your Lambda's VPC configuration allows outbound traffic to RDS
If you're using IAM auth, your Lambda code will look something like this for MySQL:
const token = await rdsSigner.getAuthToken({
region: 'us-east-1',
hostname: 'my-db.123456789012.us-east-1.rds.amazonaws.com',
port: 3306,
username: 'lambda-user'
});
What are common mistakes when granting RDS access?
Three mistakes happen over and over — using the master user for applications, forgetting to update security groups, and not testing access before sharing credentials.
Let's break them down:
- Master User Abuse:
Using your root credentials for application access is like giving your house keys to the pizza delivery guy. Create dedicated users instead.
- Security Group Blind Spots:
AWS changed the default security group behavior in 2024 to block all external traffic. Many people get stuck here because they didn't update their security groups.
- Untested Credentials:
Always test new access yourself before sharing it. You'd be surprised how often typos in usernames or passwords cause delays.
Add these to your checklist before granting any access.
How do I monitor who's accessing my RDS instance?
Enable database authentication logs and export them to CloudWatch — this gives you a complete audit trail of all access attempts.
Here's what to turn on:
- Database Logs:
- In RDS console → your instance → Logs & events
- Enable "Error logs", "General logs", and "Slow query logs"
- Log Exports:
- Turn on "Publish logs to CloudWatch Logs"
- Set up log groups for different log types
- CloudWatch Alerts:
- Create alarms for suspicious activity (failed logins, unusual query patterns)
Set aside time weekly to review these logs — early detection beats damage control every time.
Can I give access to an RDS read replica?
Yes, but you'll need to configure access separately for each replica — permissions don't automatically propagate.
Two approaches work here:
- Same Credentials Method:
- Use the same database user credentials for both primary and replica
- Applications connect to the replica's endpoint instead of the primary
- Dedicated Credentials Method:
- Create a separate database user for the replica
- Grant only read permissions to this user
For most use cases, the dedicated credentials approach is cleaner and more secure.
What's the most secure way to share RDS credentials?
Avoid sharing credentials directly — use AWS Secrets Manager or Parameter Store instead — these services let you grant temporary access without exposing passwords.
Three secure sharing methods:
- AWS Secrets Manager:
- Store your database credentials securely
- Grant IAM users/roles permission to retrieve secrets
- Set automatic rotation schedules
- Parameter Store:
- Simpler alternative for less sensitive credentials
- Use SecureString parameters for passwords
- Temporary Credentials:
- Generate one-time-use credentials
- Share only the temporary credentials
Between these, Secrets Manager is generally the best balance of security and functionality.
How do I give access to an RDS instance in another AWS account?
Use AWS RAM (Resource Access Manager) to share your RDS instance — this creates a resource share that the other account can access.
Here's how to set this up:
- In the Sharing Account:
- Go to AWS RAM console
- Create a resource share
- Select your RDS instance and choose "Database" as the resource type
- In the Receiving Account:
- Accept the resource share invitation
- Create an IAM policy allowing RDS access
- Attach the policy to users/roles needing access
This approach maintains security while allowing cross-account access.
Edited and fact-checked by the TechFactsHub editorial team.