By Morgan Lucas, From Adrian Cantril’s More Than Certified / GitHub
Technologies used: AWS, Lambda, Step Functions, API Gateway, S3, SNS & SES.
What Is This?:
A small app for pets to both you for cuddles that will send an alert to a phone and an email address. Both points of contact must be opted into first.
Stage 1
- I register 4 objects - Two email addresses (sending messages, receiving messages) and 2 phone numbers (one to receive SMS [text messages], and an origination number.
Stage 2
- I used CloudFormation (again, our old friend) to create an IAM role that email_reminder_lambda uses to interact with other AWS services. Really beats searching through the policies!
- In the Lambda console, I create a function that uses Python 3.9 rundown and use the LambdaRole created via CloudFormation. There are multiple entries called some variation of LambdaRole, so look for the one with SES/SNS and CloudWatch roles.
- The function in question needs the email address added, so it goes from
FROM_EMAIL_ADDRESS = 'REPLACE_ME
To
FROM_EMAIL_ADDRESS = '[email protected]
Stage 3
- Making and configuring the state machine through a CloudFormation stack yet again. It has the ability to invoke the email lambda function to send emails, logging permissions and SNS sending abilities.
- The State machine will be written in Amazon States Language, which looks like JSON to me.