That was the moment I stopped trusting half-baked access policies and started treating AWS database access as a first-class security problem. If a database holds the crown jewels of an application, its shell and command-line access can’t be left to chance. Every query, every connection, every authentication handshake — they all matter. AWS makes it possible to lock this down with precision, but most teams still leave dangerous gaps.
The foundation is identity. AWS IAM gives you fine-grained control, but you need to bind policies to the actual roles and tasks that people perform, not just their job titles. Avoid wildcards. Restrict access to specific databases, tables, and queries where possible. Require MFA even for non-console usage. Managed identities for EC2 or Lambda functions should be the default, not the exception.
The shell is next. AWS Systems Manager Session Manager is your friend. It cuts out open inbound ports, kills the need for exposed SSH keys, and delivers session logging to CloudWatch or S3. With the right IAM boundaries, you eliminate the nightmare of leaked private keys granting someone unrestricted shell access to production databases.