Sql-server – Amazon EC2 SQL Server Connection

sqlsql server

I have two instances running on Amazon AWS EC2. One is running MSSQL Server 2005, the other is running a web application.

I CAN connect to the database in my app using a connection string that references the Public IP of my EC2 instance running SQL Server.

I CANNOT connect from the web app server if I change the connection string to reference the database servers Private IP Address. But I can connect if I run that same code on the database server itself.

I can remote desktop from the app server to the database server using the private IP.

I have a feeling there is something in my SQL Sever configuration that is preventing this remote connection. I have remote connections enabled, I have it set to listen on all IP addresses.

Any ideas?

Other things I've done:
– Added exceptions to Windows Firewall
– Tried connecting to using EC2 DNS Names

Best Answer

EC2 instances have their own firewall too, known as "security groups". Make sure you add the right IPs and ports to the security group to allow access between the servers. Bear in mind that traffic will likely be going over the public internet, and you might want to (read: Really should) use a SSL VPN between your two instances.

Related Topic