Sending email using Amazon Web Services
I'm thinking of setting up a simple web application that sends the user a confirmation email when they first register. If I build this on the Amazon Web Service infrastructure, how can I send email from another instance? I would probably have one instance that is just f开发者_StackOverflow中文版or the application and another instance for the email server.
My question is how does the first instance (the app server) know the IP address of the second instance (the email server)? It is my understanding that the instances can run on any number of servers and can be brought up and down. How does that allow one instance to connect to another instance?
After asking your question, Amazon has since launched Amazon Simple Email Service for this and you would not need a separate instance for an email server. It is available as a web service that you can call to send email. They also have SDK's to wrap the web services in .NET, Java, and PHP.
I'm not sure why you'd want to only send the e-mail from a single instance, since there's nothing special about sending e-mail. That being said, I'd look at a simpler coupling model like Amazon's Simple Queue Service.
Don't attempt to send email directly from an EC2 instance; it will not work reliably as the EC2 IP ranges have been blacklisted by various providers. You'll need to use a thirty-party service such as Google Apps.
精彩评论