Use existing AWS resources
Set up existing analytics backend
The manual setup enables you to use your existing Amazon Pinpoint resource in your app.
import { Amplify } from 'aws-amplify';import { parseAmplifyConfig } from "aws-amplify/utils";import amplifyconfig from './amplifyconfiguration.json';
const resourceConfig = parseAmplifyConfig(amplifyconfig);
Amplify.configure({  ...resourceConfig,  Analytics: {    ...resourceConfig.Analytics,    Pinpoint: {      // REQUIRED -  Amazon Pinpoint App Client ID      appId: 'XXXXXXXXXXabcdefghij1234567890ab',
      // REQUIRED -  Amazon service region      region: 'us-east-1',
      // OPTIONAL - How many events can be buffered at once.      bufferSize: 1000,
      // OPTIONAL - How many events will be flushed from the buffer per batch.      flushSize: 100,
      // OPTIONAL - The interval in milliseconds to perform a buffer check and flush if necessary.      flushInterval: 5000, // 5s
      // OPTIONAL - The limit for failed recording retries.      resendLimit: 5    }  }});Update your IAM Policy
Amazon Pinpoint service requires an IAM policy in order to use the record and identifyUser APIs:
{  "Version": "2012-10-17",  "Statement": [    {      "Effect": "Allow",      "Action": ["mobiletargeting:UpdateEndpoint", "mobiletargeting:PutEvents"],      "Resource": ["arn:aws:mobiletargeting:*:${accountID}:apps/${appId}*"]    }  ]}