- Active AWS credentials
- pip
- AWS SAM CLI
- SES in production mode (see here)
- Verified Domains and/or E-Mail Id in SES (see here)
- Install python modules:
pip install -r src/newsletter_email/requirements.txt -t src/newsletter_email/dependencies/python
- Run SAM deployment:
sam deploy --parameter-overrides \
EmailSender=noreply@stormfsi.de \
"EmailWhitelistPattern=(^[a-zA-Z0-9_.+-]+@reply\.(de|it|com|eu)$)" \
"MailFrequency=rate(7\ days)" \
CutoffDays=7 \
OpsEmailid=<YOUR_OPS_EMAIL> \
--guided
See these example values for SAM:
Stack Name [sam-app]: awsnewsletteremailer
AWS Region [eu-central-1]:
Confirm changes before deploy [y/N]: N
Allow SAM CLI IAM role creation [Y/n]: Y
Disable rollback [y/N]: N
NewsletterSubscribersFunction may not have authorization defined, Is this okay? [y/N]: y
Save arguments to configuration file [Y/n]: Y
SAM configuration file [samconfig.toml]: <ENTER>
SAM configuration environment [default]: <ENTER>
First of all you need to set export LOCAL_TEST=true
.
Then create a virtual env and run the newsletter.py
python3 -m venv /tmp/python_venv
. /tmp/python_venv/bin/activate
pip install -r src/newsletter_email/requirements.txt
cd src/newsletter_email
python newsletter.py
Open the URL given in the output of the SAM deployment. Enjoy! 😎 🌟