Page updated Jan 26, 2024

Use existing AWS resources

Set up existing analytics backend

The manual setup enables you to use your existing Amazon Pinpoint resource in your app.

1import { Amplify } from 'aws-amplify';
2
3Amplify.configure({
4 ...Amplify.getConfig(),
5 Analytics: {
6 ...Amplify.getConfig().Analytics,
7 Pinpoint: {
8 // REQUIRED - Amazon Pinpoint App Client ID
9 appId: 'XXXXXXXXXXabcdefghij1234567890ab',
10
11 // REQUIRED - Amazon service region
12 region: 'us-east-1',
13
14 // OPTIONAL - How many events can be buffered at once.
15 bufferSize: 1000,
16
17 // OPTIONAL - How many events will be flushed from the buffer per batch.
18 flushSize: 100,
19
20 // OPTIONAL - The interval in milliseconds to perform a buffer check and flush if necessary.
21 flushInterval: 5000, // 5s
22
23 // OPTIONAL - The limit for failed recording retries.
24 resendLimit: 5
25 }
26 }
27});

Update your IAM Policy

Amazon Pinpoint service requires an IAM policy in order to use the record and identifyUser APIs:

1{
2 "Version": "2012-10-17",
3 "Statement": [
4 {
5 "Effect": "Allow",
6 "Action": ["mobiletargeting:UpdateEndpoint", "mobiletargeting:PutEvents"],
7 "Resource": ["arn:aws:mobiletargeting:*:${accountID}:apps/${appId}*"]
8 }
9 ]
10}