101%云托管邮件解决方案(AWS Browser SDK + Lambda + Dynamo + SES)
Complete newsletter application that has no “old-style” backend components. See how does it look like. All features are implemented using Amazon’s cloud stack.
It’s the trickiest part of the whole setup. Steps depend on each other, so do it in presented order.
aws.region
in config file)amazonLogin.clientId
)aws.imagesBucketName
) and add CORS config (aws/images-bucket-cors-config.xml
)sender
property in config)awsletter_lambda_executor
role (of course you can name it as you wish)aws/lambda-executor-policy.json
) to this role; provide template with a real bucket nameaws/lambda-executor-trust-policy.json
) to this role; it states that Lambda can assume this roleThere’s a list of functions to create:
Function name | Code | Memory | Timeout | Notes |
---|---|---|---|---|
awsletter-send-mail |
lambdas/send-mail.js |
512 | 5 | |
awsletter-send-sms |
lambdas/sens-sms.js |
256 | 10 | Provide Twilio credentials |
awsletter-resize-image |
lambdas/resize-image.js |
512 | 15 | Provide image width |
Please note:
awsletter_lambda_executor
) should be used for all functionsaws.mailFunctionName
and aws.smsFunctionName
in config fileawsletter_lambda_resize_caller
roleaws/lambda-resize-caller-policy.json
) to this role; provide template with function nameaws/lambda-resize-caller-trust-policy.json
) to this role; provide template with bucket name; this policy states that S3 bucket can assume this role (so it can invoke resize function)awsletter_web_user
roleaws/web-role-policy.json
) to this role; provide template with bucket name and function namesaws/web-role-trust-policy.json
) to this role; provide template with “Login with Amazon” Client IDYeah, I know. I’m working on automating this process. In case of any (project-related) problems, you can contact me, I’ll try to help.
Just clone repository, copy reference config file and adjust it:
$ git clone git@github.com:jelz/awsletter.git
$ cd awsletter
$ cp config/config.js.dist public/app/config.js
$ vi public/app/config.js
Then you need to serve public/
directory. Use python -m SimpleHTTPServer
or grunt
(default task runs server).
MIT