Rohit Buwa
Rohit Buwa

Reputation: 17

Amazon S3 policy to receive Daily SMS usage reports - not working

We have configured S3 bucket to receive Daily SMS usage reports from AWS SNS.

But the S3 bucket is not receiving any reports.

Here is policy we are using:

{
    "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:::bucket-name/*"
        },
        {
            "Sid": "AllowGetBucketLocation",
            "Effect": "Allow",
            "Principal": {
                "Service": "sns.amazonaws.com"
            },
            "Action": "s3:GetBucketLocation",
            "Resource": "arn:aws:s3:::bucket-name"
        }
    ]
}

Upvotes: 0

Views: 1247

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269330

To test this, I did the following:

  • Created an Amazon S3 bucket
  • Applied the above Bucket policy (substituting my bucket name)
  • In Amazon SNS, configured the SMS usage report to be delivered to this bucket
  • Send an SMS
  • Waited two days

The report finally appeared in my S3 bucket, called:

SMSUsageReports/ap-southeast-2/2018/10/31/001.csv.gz

The content was:

PublishTimeUTC,MessageId,DestinationPhoneNumber,MessageType,DeliveryStatus,PriceInUSD,PartNumber,TotalParts
2018-10-31T06:40:29.247Z,xxx,+61xxx,Promotional,Message has been accepted by phone,0.05878,1,1

So, it seems to take a long time to arrive, but it does arrive.

I also note that the first 100 SMS messages sent to a US number are free, so it is possible that free messages do not generate a usage report (but I used a non-US number, so I don't know whether this is the case).

Upvotes: 2

Related Questions