Menu
Amazon Simple Notification Service
Developer Guide (API Version 2010-03-31)

Viewing Daily SMS Usage Reports

You can monitor your SMS deliveries by subscribing to daily usage reports from Amazon SNS. Each day that you send at least one SMS message, Amazon SNS will deliver a usage report as a CSV file to an Amazon S3 bucket that you specify.

Daily Usage Report Information

The usage report includes the following information for each SMS message that was successfully delivered by your account:

  • Time that the message was published (in UTC)

  • Message ID

  • Destination phone number

  • Message type

  • Delivery status

  • Message price (in USD)

  • Part number (a message is split into multiple parts if it is too long for a single message)

  • Total number of parts

Subscribing to Daily Usage Reports

To subscribe to daily usage reports, you must create an Amazon S3 bucket with the appropriate permissions.

To create an Amazon S3 bucket for your daily usage reports

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. Choose Create Bucket.

  3. For Bucket Name, type a name, such as sns-sms-daily-usage. For information about conventions and restrictions for bucket names, see Rules for Bucket Naming in the Amazon Simple Storage Service Developer Guide.

  4. Choose Create.

  5. In the All Buckets table, select the bucket and choose Properties.

  6. In the Permissions section, choose Add bucket policy.

  7. In the Bucket Policy Editor window, provide a policy that allows the Amazon SNS service principal to write to your bucket. For an example, see Example Bucket Policy.

    If you use the example policy, remember to replace my-s3-bucket with the name of your bucket.

  8. Choose Save.

To subscribe to daily usage reports

  1. Sign in to the AWS Management Console and open the Amazon SNS console at https://console.aws.amazon.com/sns/v2/home.

  2. In the navigation pane, choose Text messaging (SMS).

  3. On the Text messaging (SMS) page, choose Manage text messaging preferences.

  4. On the Text messaging preferences page, for Reports storage, type the name of the Amazon S3 bucket that will receive the daily SMS usage reports.

  5. Choose Update preferences.

For information about the other options on the Text messaging preferences page, see Setting Preferences (Console).

After you subscribe to daily usage reports, you can view the reports in the Amazon S3 console. You can also go to the Text messaging (SMS) page in the Amazon SNS console and choose the Usage button.

Example Bucket Policy

The following policy allows the Amazon SNS service principal to perform the s3:PutObject and s3:GetBucketLocation actions. You can use this example when you create an Amazon S3 bucket to receive daily SMS usage reports from Amazon SNS.

Copy
{ "Version": "2012-10-17", "Id": "sns-sms-daily-usage-policy", "Statement": [ { "Sid": "AllowPutObject", "Effect": "Allow", "Principal": { "Service": "sns.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::my-s3-bucket/*" }, { "Sid": "AllowGetBucketLocation", "Effect": "Allow", "Principal": { "Service": "sns.amazonaws.com" }, "Action": "s3:GetBucketLocation", "Resource": "arn:aws:s3:::my-s3-bucket" } ] }

Example Daily Usage Report

After you subscribe to daily usage reports, each day, Amazon SNS puts a CSV file with usage data in the following location:

Copy
<my-s3-bucket>/SMSUsageReports/<region>/YYYY/MM/DD/00x.csv.gz

Each file can contain up to 50,000 records. If the records for a day exceed this limit, Amazon SNS will add multiple files.

The following shows an example report:

Copy
PublishTimeUTC,MessageId,DestinationPhoneNumber,MessageType,DeliveryStatus,PriceInUSD,PartNumber,TotalParts 2016-05-10T03:00:29.476Z,96a298ac-1458-4825-a7eb-7330e0720b72,1XXX5550100,Promotional,Message has been accepted by phone carrier,0.90084,1,1 2016-05-10T03:00:29.561Z,1e29d394-d7f4-4dc9-996e-26412032c344,1XXX5550100,Promotional,Message has been accepted by phone carrier,0.34322,1,1 2016-05-10T03:00:30.769Z,98ba941c-afc7-4c51-ba2c-56c6570a6c08,1XXX5550100,Transactional,Message has been accepted by phone carrier,0.27815,1,1 . . .