Kubernetes on AWS

The AWS cluster configuration script Kubernetes comes with works pretty much flawlessly, with two exceptions. First, make sure you have curl installed on the system you are bootstrapping the cluster from. And, second, make sure the awscli package is recent.

The Debian AWS AMI does not come with curl installed and the awscli package is an old version: aws-cli/1.4.2 Python/3.4.2 Linux/3.16.0-4-amd64).“ After running pip install --upgrade awscli you should see a version at least: aws-cli/1.10.24 Python/2.7.9 Linux/3.16.0-4-amd64 botocore/1.4.15.

Good times.

Amazon SES with Python and Django

Send via SES from Python? Check.

It’s amazing to see that a product that Amazon announces has ready-to-use python code overnight. Getting setup to send email using Amazon’s Simple Email Service is a breeze using Harry Marr’s [1] boto and Django-SES packages available on github [2][3].

Using SES directly in python is a matter of instantiating an SESConnection and calling send_email:


from boto.ses import SESConnection

source = "from@example.com"
subject = "hello SES!"
body = "email message from python!"
to_addresses = ["to@example.com"]

connection = SESConnection(aws_access_key_id=<your id>, aws_secret_access_key=<your key>)
connection.send_email(source, subject, body, to_addresses)

Integrating it into django is pretty trivial, just add to settings.py:


EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_ACCESS_KEY_ID = <your id>
AWS_SECRET_ACCESS_KEY = <your key>

Once that’s in your settings, your application doesn’t have to change at all to send via SES.

The downside: SES does not handle attachments, period. You can only send text or HTML-formatted emails. If you need to send files, you’re out of luck for now.

Resources:
[1] http://hmarr.com/2011/jan/26/using-amazons-simple-email-service-ses-with-django/
[2] https://github.com/hmarr/boto
[3] https://github.com/hmarr/django-ses