AWS Classic resources run in a shared environment with infrastructure owned by other AWS customers.
You should run resources in a VPC instead. In this, your instances run in a virtual private cloud (VPC) that's logically isolated to your AWS account, enhancing the security of your cloud-native infrastructure.
resource "aws_db_security_group" "my-group" {
# ...
}
resource "aws_security_group" "allow-db-access" {
# ...
}