(sdd412) amazon simple email service deep dive and best practices | aws re:invent 2014

71

Upload: amazon-web-services

Post on 30-Jun-2015

342 views

Category:

Travel


5 download

DESCRIPTION

Almost all applications and services have a need to communicate over email. Amazon Simple Email Service (SES) enables email functionality that will scale with your business. So what should an email-sending application that integrates with SES look like? In this session we cover common patterns, architectures, and best practices that you can use to build a robust email solution that takes advantage of the SES platform.

TRANSCRIPT

Page 1: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 2: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 3: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 4: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 5: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

SMTP

HTTPS

ISPs

Amazon SES

Page 6: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 7: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 8: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 9: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 10: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

• Amazon SES integrates with Amazon Route 53

Page 11: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

DKIM with Amazon SES (2/2)

• Automatic key rotation

Sender Amazon SESSigned Email

ISP

Add DKIM Signature

Signed Email 2

DNS

Fetch Public DKIM Key

Page 12: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 13: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 14: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 15: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 16: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 17: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 18: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 19: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 20: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

• Use HTTP instead of SMTP

• Use persistent connections

• Send in parallel– Use multiple processes/threads

– Use multiple hosts

SMTP HTTPS

Page 21: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 22: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 23: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Introduction

Example

Page 24: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

– Bounce

– Complaint

– Delivery

Amazon SNSEmail

Page 25: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 26: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

permanent, transient undetermined

– Invalid email address

– Mailbox full

– Message too large

Recommended actions:

– Permanent: Stop sending to address

– Transient: Depends on type

– Undetermined: Manually review

Page 27: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

spam

Recommended action: Stop sending to address

Page 28: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

successful delivery

Common actions: Auditing and tracking

Page 29: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

ISP SenderAmazon SES Amazon SNS

SendEmail

Complaint Complaint Notification

Delivery Notification

SNS Topic

Page 30: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

{

"notificationType":"Bounce",

"bounce":{

"bounceType":"Transient",

"bounceSubType":"MailboxFull",

"bouncedRecipients":[{

"emailAddress":"[email protected]",

"diagnosticCode":"550 5.2.2 Rcpt Mailbox Full"

}],

"timestamp":"2015-06-19T01:07:52.000Z"

},

"mail":{

"source":"[email protected]",

"messageId":"00000138111222aa-33322211-cccc-dddd"

}

}

Page 31: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Amazon SQSAmazon SNS AWS Elastic Beanstalk

Page 32: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

1. Configure SNS topic to receive notifications

2. Create SQS queue and subscribe to SNS topic

3. Create Elastic Beanstalk worker tier application

4. Deploy Python notification processor

Page 33: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

ISP SenderAmazon SESAmazon

SNS

SendEmail

Complaint Notification

SNS topic SQS queue

Amazon

SQS

Page 34: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

1. Configure SNS topic to receive notifications

2. Create SQS queue and subscribe to SNS topic

3. Create Elastic Beanstalk worker tier application

4. Deploy Python notification processor

Page 35: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Amazon

SQS

AWS

Elastic Beanstalk

Amazon

RDS

Page 36: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

1. Configure SNS topic to receive notifications

2. Create SQS queue and subscribe to SNS topic

3. Create Elastic Beanstalk worker tier application

4. Deploy Python notification processor

Page 37: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Get message from queue and

post to app

Parse notification & determine

type

Update email list or manually

review

Return success response

Delete message from queue

Page 38: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

application = flask.Flask(__name__)

@application.route('/process', methods=['POST'])

def process():

message = json.loads(request.json['Message'])

if message['notificationType'] == 'Bounce’:

if message['bounce']['bounceType'] == 'Permanent':

remove_recipients_from_list(message)

elif message['bounce']['bounceType'] == 'Transient':

if message['bounce']['bounceSubType'] == 'MailboxFull':

temporarily_suspend_sending(message)

else:

manually_review_notification(message)

else:

manually_review_notification(message)

elif message['notificationType'] == 'Complaint':

remove_recipients_from_list(message)

return Response("", status=200)

Handle new

notification

types

Return success

response

Use Flask for

HTTP server

Page 39: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

1. Configure SNS topic to receive notifications

2. Create SQS queue and subscribe to SNS topic

3. Create Elastic Beanstalk worker tier application

4. Deploy Python notification processor

mailbox simulator

[email protected]

[email protected]

Page 40: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Introduction

Example

Page 41: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 42: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 43: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 44: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 45: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 46: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 47: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

merchandizer message

customers

customer message

CustomerMerchandizers Message

Page 48: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 49: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 50: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 51: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

merchandizer planner

message customer

customer

Merchandizers CustomerMessage Planner

Page 52: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

merchandizers customer

message

Page 53: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

CampaignID List of RecipientIDs

1 [1,2]

2 [2]

3 [2,3]

cn [r1,r2,r3,…]

Page 54: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Map

Page 55: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Map Reduce

Page 56: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Best

campaign

commit

Prioritization

Logic

Page 57: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 58: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 59: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 60: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Page 61: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Holdout

Population that

will receive message5¢/mail

6¢/mail

Within 6 months

Page 62: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

For each recipient R

For each email campaign M targeting R

For each experiment E containing campaign M

End For

End For

End For

Page 63: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Page 64: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Page 65: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Page 66: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Incremental

value A

Incremental

value B

We should use group B for targeting

Page 67: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Incremental

value A

Incremental

value B

We should use both groups for targeting

Page 68: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Within 6 months Within 4-10 months

Page 69: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 70: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014
Page 71: (SDD412) Amazon Simple Email Service Deep Dive and Best Practices | AWS re:Invent 2014

Please give us your feedback on this session.

Complete session evaluations and earn re:Invent swag.

http://bit.ly/awsevals