Amazon Personalize is a machine learning service by AWS. It enables you to create high-quality content recommendations, personalized product and marketing promotions, and much more.

RudderStack supports AWS Personalize as a destination where you can send your event data seamlessly.

Find the open source code for this destination in the GitHub repository.
To use PutUsers and PutItems permissions for this destination, use the latest images for rudder-server and rudder-transformer.

Getting started

RudderStack supports sending event data to Personalize via the following connection modes:

Connection ModeWebMobileServer
Device mode---
Cloud modeSupportedSupportedSupported

Once you have confirmed that the source platform supports sending events to Personalize, follow these steps:

  1. Generate a Tracking ID by following these instructions.
  2. From your RudderStack dashboard, add the source. Then, from the list of destinations, select Amazon Personalize.
  3. Assign a name to your destination and click Continue.

Connection settings

To successfully set up Personalize as a destination, you need to configure the following settings:

  • Role-based Authentication: Enable this setting to use the RudderStack IAM role for authentication. For more information on creating a AWS IAM role for RudderStack, refer to this guide.
    • IAM Role ARN: Enter the ARN of the IAM role.
It is highly recommended to enable this setting as the access keys-based authentication will be deprecated in the future.
  • If Role-based Authentication is disabled, you need to enter the AWS Access Key ID and AWS Secret Access Key to authorize RudderStack to send data to Personalize.
In both the role-based and access key-based authentication methods, you need to set a policy specifying the required permissions for RudderStack to send data to Personalize. Refer to the Policy permissions section below for more information.
  • Region: Enter the region associated with your AWS account in this field.
  • TrackingId: Enter the Tracking ID generated in the Getting started section above.
  • Dataset ARN: Enter the dataset ARN of the dataset from the chosen dataset group.
  • Personalize Events: Choose the type of Personalize event you want to avail.
  • Map all the fields: Enter the Schema Field used to create the schema in AWS Personalize (for example, USER_ID, TIMESTAMP, ITEM_ID, etc.). Also, enter the corresponding Mapped Field - RudderStack takes the value from this field present in the event payload and maps it to the Schema Field.
For more information on creating a schema in Personalize, refer to the Personalize documentation.
When using the PutItems operation, you need to provide the path to the Mapped Field corresponding to the ITEM_ID present in your Personalize database schema.
  • Disable Stringifying Additional Properties: This setting disables the conversion of additional properties to string data type in Personalize.
This is an exclusive setting only applicable for the putEvents operation. If it is disabled, RudderStack converts any mapped fields other than ITEM_ID, EVENT_VALUE, IMPRESSION, RECOMMENDATION_ID, TIMESTAMP, EVENT_TYPE, and USER_ID to a string before forwarding to Personalize.

Policy permissions

To use the Personalize destination with RudderStack correctly, you must have a Personalize service set up in AWS. Refer to the AWS documentation for more information on setting up your Amazon Personalize account.

You also need to create an IAM role and grant the necessary permissions for RudderStack to send data to Personalize. The following actions need to be attached to the role while setting up the AWS policy:

"Action": [
"personalize:PutEvents",
"personalize:PutUsers",
"personalize:PutItems"
]

You can use these actions based on the type of Personalize events you want to send. For example, to send only putEvents type of events, you can attach only personalize:PutEvents.

A sample permissions policy that allows a user to send event data into Personalize is shown below:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CloudWatchEventsInvocationAccess",
"Effect": "Allow",
"Action": [
"personalize:PutEvents"
"personalize:PutUsers",
"personalize:PutItems"
],
"Resource": "*"
}
]
}

Identify

The identify call lets you use the PutUsers operation of Personalize.

For the PutUsers operation, the value of the userId or anonymousId field in the payload will be sent as userId.
For PutUsers, you must specify the Dataset ARN field in the RudderStack dashboard.

The following snippet highlights a sample identify event with the Mapped Field setting specified in the dashboard:

rudderanalytics.identify("1hKOmRA4GRlm", {
name: "Alex",
email: "alex@example.com"
});

Track

The track call lets you use PutEvents and PutItems operations of Personalize.

For PutEvents, RudderStack sends the value of the event field in the payload as EVENT_TYPE. Also, the value of the timestamp or originalTimestamp fields in the payload will be sent as sentAt.
For the PutItems and PutEvents operations, it is mandatory to specify the Dataset ARN and Tracking ID settings in the RudderStack dashboard.

The following snippet shows a sample track event with the mapped field specified in the dashboard settings:

rudderanalytics.track("Product Added", {
typeOfSdk: "javascript",
numberOfRatings: "12",
X: "item 1",
});

When using the PutItems, the Schema Field ITEM_ID must be mapped to a specific key inside the payload. You also need to mention the path to the chosen key as the corresponding Mapped Field.

In the above example, if you map ITEM_ID to the payload field X, the corresponding Mapped Field will be properties.X.

For any other Schema Field in your ITEMS dataset, it is not recommended to specify the path - only the field name is sufficient.
When using PutEvents, the Mapped Field for ITEM_ID should not contain the path to the field. Only the name of the field will be sufficient. The same rule is applicable for any other Schema Field mapping.

The following image shows an example of the dashboard configuration for PutItems:

PutItems

The following image shows an example of the dashboard configuration for PutEvents:

Dashboard Configuration Based On The Above Example

Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.

On this page