Amazon Pinpoint
Developer Guide

Logging Amazon Pinpoint API Calls with AWS CloudTrail

Amazon Pinpoint is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Amazon Pinpoint. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, Amazon CloudWatch Logs, and Amazon CloudWatch Events. Using the information collected by CloudTrail, you can determine the request that was made to Amazon Pinpoint, the IP address the request was made from, who made the request, when it was made, and additional details.

To learn more about CloudTrail, including how to configure and enable it, see the AWS CloudTrail User Guide.

Amazon Pinpoint Information in CloudTrail

Amazon Pinpoint supports logging the following actions as events in CloudTrail log files:


The following Amazon Pinpoint actions are not logged in CloudTrail:

  • GetEndpoint

  • SendMessages

  • SendUsersMessages

  • UpdateEndpoint

  • UpdateEndpointsBatch

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:

  • Whether the request was made with root or IAM user credentials.

  • Whether the request was made with temporary security credentials for a role or federated user.

  • Whether the request was made by another AWS service.

For more information, see the CloudTrail userIdentity Element.

You can create a trail and store your log files in your Amazon S3 bucket for as long as you want, and define Amazon S3 lifecycle rules to archive or delete log files automatically. By default, your log files are encrypted with Amazon S3 server-side encryption (SSE).

To be notified of log file delivery, configure CloudTrail to publish Amazon SNS notifications when new log files are delivered. For more information, see Configuring Amazon SNS Notifications for CloudTrail.

You can also aggregate Amazon Pinpoint log files from multiple AWS Regions and multiple AWS accounts into a single Amazon S3 bucket.

For more information, see Receiving CloudTrail Log Files from Multiple Regions and Receiving CloudTrail Log Files from Multiple Accounts.

Example: Amazon Pinpoint Log File Entries

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files are not an ordered stack trace of the public API calls, so they do not appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the GetCampaigns and CreateCampaign actions.

{ "Records": [ { "awsRegion": "us-east-1", "eventID": "example0-09a3-47d6-a810-c5f9fd2534fe", "eventName": "GetCampaigns", "eventSource": "", "eventTime": "2018-02-03T00:56:48Z", "eventType": "AwsApiCall", "eventVersion": "1.05", "readOnly": true, "recipientAccountId": "123456789012", "requestID": "example1-b9bb-50fa-abdb-80f274981d60", "requestParameters": { "application-id": "example71dfa4c1aab66332a5839798f", "page-size": "1000" }, "responseElements": null, "sourceIPAddress": "", "userAgent": "Jersey/${project.version} (HttpUrlConnection 1.8.0_144)", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "accountId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "principalId": "123456789012", "sessionContext": { "attributes": { "creationDate": "2018-02-02T16:55:29Z", "mfaAuthenticated": "false" } }, "type": "Root" } }, { "awsRegion": "us-east-1", "eventID": "example0-09a3-47d6-a810-c5f9fd2534fe", "eventName": "CreateCampaign", "eventSource": "", "eventTime": "2018-02-03T01:05:16Z", "eventType": "AwsApiCall", "eventVersion": "1.05", "readOnly": false, "recipientAccountId": "123456789012", "requestID": "example1-b9bb-50fa-abdb-80f274981d60", "requestParameters": { "Description": "***", "HoldoutPercent": 0, "IsPaused": false, "MessageConfiguration": "***", "Name": "***", "Schedule": { "Frequency": "ONCE", "IsLocalTime": true, "StartTime": "2018-02-03T00:00:00-08:00", "Timezone": "utc-08" }, "SegmentId": "exampleda204adf991a80281aa0e591", "SegmentVersion": 1, "application-id": "example71dfa4c1aab66332a5839798f" }, "responseElements": { "ApplicationId": "example71dfa4c1aab66332a5839798f", "CreationDate": "2018-02-03T01:05:16.425Z", "Description": "***", "HoldoutPercent": 0, "Id": "example54a654f80948680cbba240ede", "IsPaused": false, "LastModifiedDate": "2018-02-03T01:05:16.425Z", "MessageConfiguration": "***", "Name": "***", "Schedule": { "Frequency": "ONCE", "IsLocalTime": true, "StartTime": "2018-02-03T00:00:00-08:00", "Timezone": "utc-08" }, "SegmentId": "example4da204adf991a80281example", "SegmentVersion": 1, "State": { "CampaignStatus": "SCHEDULED" }, "Version": 1 }, "sourceIPAddress": "", "userAgent": "aws-cli/1.14.9 Python/3.4.3 Linux/3.4.0+ botocore/1.8.34", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "accountId": "123456789012", "arn": "arn:aws:iam::123456789012:user/userName", "principalId": "AIDAIHTHRCDA62EXAMPLE", "type": "IAMUser", "userName": "userName" } } ] }