ec2 instance will not allow connections to port from within instance after opening port on security group

But I am unable to connect to the instance on port 25 from within the instance using its public ip or hostname. I don't get a connection refused or anything, just a timeout.

Amazon EC2 doesn't allow outbound SMTP traffic from instances (unless you've applied for and received an exception for your account). This means you can't reach your server's SMTP server -- or anyone else's -- by its public IP address.

If you need to connect to the local host, connect to localhost.