Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 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.

share|improve this answer
    
An article by Amazon says: "By default, the firewall protecting the instance will not allow any traffic from the Internet. However, it permits all traffic between your Amazon EC2 instances." Both of my servers are in the same account and availability zone. Do you still think I have to setup rules in the security groups? The whole article is here: developer.amazonwebservices.com/connect/… –  Anonymous Apr 24 '10 at 9:00
    
So yeah... I added the rule and that did the trick. The problem I have is that I don't really want to have to add specific rules for each intance I launch. Do you know of any other solution or if I can get what I'm thinking that article says to work (for all traffic between my instances to be permitted?) –  Anonymous Apr 24 '10 at 9:03
    
Thanks for your help Tom, I think I might be onto solution now. That same article shows running this command: ec2-authorize sql_servers -P tcp -p 1433 -o web_servers -u 798512234580 Do you think I could change it to something like this? ec2-authorize my_same_group -P tcp -p 1433 -o my_same_group -u 798512234580 –  Anonymous Apr 24 '10 at 9:30
    
Yes... that did it. I figured out this commandline stuff (great tutorial here learnaws.com/archives/6) and ran that command and now I can connect to the private IP. –  Anonymous Apr 24 '10 at 9:48
    
@cnxmax If you liked the answer, you could accept it :) –  Tom O'Connor Apr 26 '10 at 7:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.