# AWS SNS

### Overview

The AWS SNS Connector allows you to send SMS messages using **Amazon Simple Notification Service (SNS)**. However, there are certain limitations and prerequisites that must be met for successful message delivery.

### Prerequisites

Before using the AWS SNS Connector to send SMS messages, ensure the following:

1. **SNS Sandbox Registration:**
   * If your AWS account is in **SNS SMS Sandbox Mode**, SMS messages can only be sent to **verified phone numbers** added in the AWS Console.
   * To register a phone number, follow [AWS documentation](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html).
2. **Region Compatibility:**
   * The SNS SMS service may be region-dependent. Ensure the selected region supports SNS SMS services.
   * Messages might only be delivered if the selected region matches your AWS account’s region.
3. **Spending Limit:**
   * AWS imposes a default **spending limit of $1 USD** for SMS.
   * If the limit is reached, no SMS will be sent.
   * Check and increase the limit in the **AWS SNS console** under SMS settings.
4. **IAM Permissions:**
   * To enable SMS delivery logs, you must have the necessary IAM permissions.
   * Without proper permissions, viewing SMS failures or debugging will not be possible.
   * Check IAM policies and request permissions if needed.

### Important Considerations

#### ✅ **200 OK Response Does Not Guarantee SMS Delivery**

* When an SMS is published via SNS, a `200 OK` response is returned.
* However, this only confirms that SNS received the request. **It does not confirm message delivery**.
* To track the status of an SMS:
  * Enable **CloudWatch Logs for SNS SMS** (requires permissions).
  * Use AWS SNS **Delivery Status Logs** to check failures.

#### ✅ **Common Issues and Solutions**

| Issue                | Cause                                     | Solution                                      |
| -------------------- | ----------------------------------------- | --------------------------------------------- |
| SMS not received     | Phone number not verified in sandbox      | Add number to SNS sandbox                     |
| 200 OK but no SMS    | No balance in the AWS SNS SMS spend limit | Increase spending limit in AWS console        |
| SMS delivery failure | Region mismatch                           | Use the correct region for SMS service        |
| Unable to view logs  | Insufficient IAM permissions              | Request permissions to enable CloudWatch logs |

### Debugging Steps

1. **Verify Phone Number:**
   * Check if the recipient's number is added in the **AWS SNS SMS sandbox**.
2. **Check Spend Limit:**
   * Go to **AWS SNS Console** → **Text Messaging (SMS)** → **Spend Limit**.
3. **Enable Logs for Debugging:**
   * Navigate to **AWS CloudWatch Logs** and enable SNS delivery status logs.
   * Ensure IAM permissions allow access to logs.
4. **Confirm Region Settings:**
   * Use a region that supports **SNS SMS delivery**.

### References

* [Publishing SMS messages to a mobile phone using Amazon SNS](https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html)
* [Adding and verifying phone numbers in the Amazon SNS SMS sandbox](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)

### Conclusion

The AWS SNS Connector itself functions correctly. However, message delivery depends on **AWS account settings, sandbox verification, spending limits, region settings, and logging permissions**. By following the prerequisites and debugging steps above, users can ensure successful SMS delivery through AWS SNS.

***

For further assistance, consult AWS support or refer to the official SNS documentation.
