Prepare Your Amazon S3 Connection
Set Up Unstructured Data from Amazon S3
MuleSoft Anypoint Connector for Salesforce Data 360
Connect unstructured data from Amazon S3 for use in your Agentforce, RAG, automation, and analytics workflows. First create an unstructured data lake object (UDLO) in Data 360 to reference the unstructured data. Then create a file notification pipeline to keep your UDLO up to date.
See the Unstructured Data File Formats and Connectors for a list of support file formats for unstructured data.
To ensure your unstructured data is properly connected to Data 360, first perform the steps to connect unstructured data from your external blob store, then set up file notifications, and finally put data in your external blob store.
Important
IdP-based authentication is only supported for structured data.
Important
Create a UDLO in Data 360 to reference unstructured data from Amazon S3.
| User Permissions Needed | |
|---|---|
| To connect unstructured data from an external blob store: | Data Cloud Architect |
Before you begin:
Make sure you’ve set up a connection to Amazon S3.
Create a file notification pipeline for Amazon S3 to notify a Salesforce connected app whenever unstructured data files are added, updated, or deleted from a bucket.
| User Permissions Needed | |
|---|---|
| AWS IAM | AWS IAM iam:AttachRolePolicy |
| Amazon S3 bucket | Create one bucket for your unstructured data and one bucket to store your AWS Lambda function source code |
| AWS Lambda |
|
| AWS Secrets Manager |
|
Before you begin install these additional tools.
To configure OAuth for the connected app you will use in your file notification pipeline, create a private/public RSA key pair and a digital x509 certificate.
If you already have a connected app that you want to use, ensure that you have the private/public RSA key pair you used to create the x509 certificate for that app, as you need them to enable OAuth in a subsequent step.
Note
From your terminal, change directories to any folder.
Create the private/public key pair.
1openssl genrsa -out keypair.pem 2048Create a digital certificate from the key pair.
1openssl req -new -x509 -nodes -sha256 -days 365 -key keypair.pem -out certificate.crtComplete the questions as prompted.
Create a pkcs8 private key from the key pair.
1openssl pkcs8 -topk8 -nocrypt -in keypair.pem -out private.keyKeep the private/public key pair and the digital x509 certificate, as you need them in the following task.
Set up a connected app to use in the file notification pipeline and apply necessary OAuth settings.
1<YOUR_ORG_URL>/services/oauth2/authorize?response_type=code&client_id=<YOUR_CONSUMER_KEY>&scope=api refresh_token cdp_ingest_api&redirect_uri=<YOUR_CALLBACK_URL>&code_challenge=SHA256The install script is supported on macOS and Linux operating systems.
Download and install jq.
Download and install the AWS CLI.
From your terminal, enter your AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN) and region.
In the directory where you extracted the file notification installer script, go to the installers/aws folder.
Open input_parameters_s3.conf and replace the environment variable values with your values.
Run the installer script. This command makes the file notification script executable.
1chmod +x setup_s3_file_notification.sh
2./setup_s3_file_notification.sh input_parameters_s3.confRefer to these variables when creating a file notification pipeline from Amazon S3 to Data 360.
| Variable | Definition |
|---|---|
SF_USERNAME | Your Salesforce org username |
SF_LOGIN_URL | Your Salesforce org login URL |
AWS_ACCOUNT_ID | Contains your AWS Account Id. |
REGION | Your AWS region |
EVENT_S3_SOURCE_BUCKET | The S3 bucket that contains your unstructured data source |
EVENT_S3_SOURCE_KEY | The data folder within your EVENT_S3_SOURCE_BUCKET |
LAMBDA_FUNCTION_S3_BUCKET | Contains the name of the S3 bucket that contains the source code ZIP file to run your Lambda function. |
LAMBDA_FUNC_LOC_S3_KEY | Contains the S3 key for the Lambda function inside the S3 bucket |
SOURCE_CODE_LOCAL_PATH | The local path for your function’s source code |
LAMBDA_ROLE | The name of the execution role to run the Lambda function. This can be any string. |
LAMBDA_FUNCTION_NAME | The name of the Lambda function to be deployed in your AWS account. This can be any string. |
RSA_PRIVATE_KEY | Contains the name of the secret you create in AWS Secret Manager when you upload the RSA private key (PEM file). Note: Do not put the contents of keypair.pem file into this variable. |
CONSUMER_KEY_NAME | Contains the name of the secret you create in AWS Secret Manager when you upload the Consumer Key created in your connected app |
CONSUMER_KEY_VALUE | The Consumer Key created in your connected app |
PEM_FILE_PATH | Contains the complete path to the keypair.pem file on your local machine. For example: /Users/Name/Documents/keypair.pem |
CALLBACK_URL | Contains the callback URL (endpoint) that Salesforce calls back to your application during OAuth. |
AWS_ACCESS_KEY_ID | Contains the access key associated with your IAM user or role |
AWS_SECRET_KEY | Contains the credentials needed to connect to your access key |
AWS_SECURITY_TOKEN or AWS_SESSION_TOKEN | Contains the credentials needed to sign API requests to AWS |
These common issues can occur when setting up a connected app or S3 file notification in Data 360. If you don’t see data connected in your org after loading unstructured data into S3 and creating a file notification pipeline, review these requirements.
Connected App
Ensure that you have:
.crt file in the connected app, not a .pem or .key file..pem file when creating the RSA private key..crt, .pem, and .key) for both the cloud function and the connected app.Unstructured Data Files and UDLO Creation
Ensure that you have:
data, and you configure the UDLO directory field as files, Data 360 looks for files at this path: <Cloud Provider Bucket>/data/files.Installer Script and Cloud Function
Ensure that you have:
AWS_SESSION_KEY, AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY).Additional Troubleshooting
| Section | Issue | Reason | Solution |
|---|---|---|---|
| Connected App | 400 error in cloud function logs | The certificate (.crt) file used in the connected app is not associated with the RSA private key file (.pem) uploaded to the cloud provider. | Recreate the keys and replace the existing key (.pem) file uploaded to the cloud provider with the certificate file used in the connected app. |
| Connected App | 403 error in cloud function logs | The connected app Org URL does not properly execute or is not available. | Ensure OAuth scopes are set properly and that the Org URL is reachable from a browser. |
| Connected App | 400 error in cloud function logs | The connected app policy settings are incorrect. | Edit the policies in the connected app: Set IP configuration to Relax IP restrictions and enable OAuth username and password. |
| Data explorer | Files uploaded to the cloud bucket/container are not refreshed in UDLO/UDMO | Incorrect file types were uploaded, for example, a UDLO is set to accept PDF files but HTML files were uploaded. | Upload the correct file types, or create new UDLOs for the file types and upload the files again. |