This repository contains a simple project that implements an SMS notification service using AWS Lambda, API Gateway, and DynamoDB.
The SMS notification service allows users to send SMS messages to recipients. It relies on AWS Lambda an API Gateway for scaling.
- AWS Lambda: Handles incoming requests from the API Gateway and executes the business logic.
- API Gateway: Directs requests to the Lambda.
- DynamoDB: Stores information about SMS messages, including sender IDs, recipient phone numbers, and message bodies.
This project uses Terraform to configure and deploy the required infrastructure.
To package the Python script used for the Lambda itself, run make-archive.sh
.
You can then use Terraform to provision and deploy the project. You will need AWS CLI installed and configured on your system.
- Error: "Invalid phone number". This error can occur when a user tries to send an SMS with an invalid or non-existent phone number. Confirm that the phone number is valid.
- No SMS Received: Either Disable the SMS Sandbox under SNS configuration, or add the desired phone number to the list of approved numbers.
To help in understanding how the API is invoked, an example request is provided below. You will have to replace the template variables with appropriate values.
curl -X POST https://${API_GATEWAY_ID}.execute-api.us-west-2.amazonaws.com/prod/sms -H "Content-Type: application/json" -d '{"first_name": "${FIRST_NAME}", "last_name": "${LAST_NAME}", "code": ${CODE}, "phone_number": "${PHONE_NUMBER}"}