Showing posts with label amazon. Show all posts
Showing posts with label amazon. Show all posts

Monday, October 26, 2009

Sending mail from EC2 Servers

Sending mail from EC2 servers, is for the most part the same as sending email from any other dedicated server. Setup Postfix and then use the "sendmail" provided by postfix. In your web applications just use "localhost" as your smtp server. This works, except that Amazon EC2 IPs are now blacklisted by Spamhaus, so corporations that fight spam based on Spamhaus info will block all your messages.

That's exactly what happened to us. I'm not the only one having email sending issues with EC2, there are several articles about the Spamhaus, EC2 issue.

Solution

Use an SMTP server external to EC2 for handling mail sending. I first tried to use gmail, but gmail alters the sender address, so that all messages appear to come from gmail, not quite what I needed.

  1. Add a relayhost entry to postfix (for me this was in /etc/postfix/main.cf)
    relayhost = mail.otherserver.com
  2. On the host that will be acting as a relay (in this example mail.otherserver.com also in the /etc/postfix/main.cf file), I added the reserved ip address for my EC2 instance to the mynetworks list
    mynetworks = 127.0.0.1/8 11.20.30.40 #where this represents the ip of my ec2 server
That's it.
After running /etc/init.d/postfix restart on both servers, no more blacklisting issues.

The problem with this is that I end up needing to have a server outside of the cloud, which brings a single point of failure and works against the scalability of cloud based solutions.

Hmmm, wonder if I could run my smtp server in Google App Engine, somehow.

Sunday, August 2, 2009

Growing an XFS partition on Amazon EBS

Amazon EBS is Amazon's Persistent Storage service. I think of it as the ability to have a "thumbdrive in the clouds". I can then "attach" that drive to an Amazon EC2 instance (a machine in the clouds).

Today I needed to add space to a filesystem. The filesystem was 10G XFS partition and I wanted to make it 30G. (don't try this if you're not using XFS, some of these notes are XFS specific).

With the help of Elastic Fox this is pretty easy. Also make sure that you have the xfs_growfs application installed on your server. On Ubuntu/Debian 'apt-get install xfsprogs'.

update: You can do all of this with Amazon Web Console now, Elastic Fox is not the recommended choice.

1. Under ElasticFox > Volumes and Snapshots, I selected the Volume I wanted to work with and chose "create a new snapshot from this volume"
2. Under ElasticFox > Volumes and Snapshots, I selected the newly created snapshot and chose "create new volume from this snapshot" (making sure to specify a size of 30G).
3. Then I detached the old volume and attached the new volume (in this case to /dev/sdp)
4. Finally, I logged in to the server and ran the xfs_growfs command 'xfs_growfs /dev/sdp', my filesystem "magically" grew to be 30G.

I've been working, on and off with EC2 for a few months now. We now have clients hosted on EC2 based infrastructure. Amazon's Elastic Compute Cloud (EC2) is a utility that makes it possible to run virtual machines (Linux,Windows and others) on remarkably powerful infrastructure provided by Amazon.

update:
Recently I tried attaching my new volume to a different device '/dev/sdg' in this case. When I tried to mount the new device I got a 'wrong fs' error. The problem is that I was not able to mount the new device while another device with the identical UUID existed. The solution was to run the following command which generates a new UUID for my new device:

xfs_admin -U generate /dev/sdg

Thursday, October 9, 2008

My EC2 Presentation

Updated my EC2Plone wiki. I also did a little video which I used to explain stuff. The video isn't perfectly accurate but gives a good idea of how things work.

Thursday, October 2, 2008

Gearing up for my first Plone Conference

Among conferences that I have attended, this one is shaping up to be the one that I stay most awake in. No offence to previous events, it's just that I work with Plone almost daily so I'm really interested. Plus I got lucky enough to do a talk about stuff I'm doing with Plone and Amazon EC2.

Tuesday, September 30, 2008

Plone on Amazon EC2

I'm scheduled to give a talk next week on using Plone with Amazon EC2. So I've started a wiki for my talk. The hope is that I'll get feedback from the Plone community and thus make my talk more relevant. So visit the wiki and comment.

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos