DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Automating Storage Tiering and Lifecycle Policies in AWS S3 Using Python (Boto3)
  • AWS WAF Classic vs WAFV2: Features and Migration Considerations
  • Advanced-Data Processing With AWS Glue
  • Understanding the Power of AWS Organizations: Streamlining Cloud Management

Trending

  • Persistent Memory for AI Agents Using LangChain's Deep Agents
  • Pragmatica Aether: Let Java Be Java
  • Jakarta EE 12: Entering the Data Age of Enterprise Java
  • Liquid Glass, Material 3, and a Lot of Plumbing
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Snowflake and Salesforce Integration With AWS AppFlow

Snowflake and Salesforce Integration With AWS AppFlow

This tutorial provides guidance on how to integrate Salesforce data source with Snowflake Cloud Data Warehouse using AWS AppFlow.

By 
Istvan Szegedi user avatar
Istvan Szegedi
·
May. 11, 20 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
18.2K Views

Join the DZone community and get the full member experience.

Join For Free

Amazon Web Services has recently announced a new service called AWS AppFlow, which is a fully managed serverless integration service to allow secure data transfer between various Software as Service providers such as Salesforce, ServiceNow, Snowflake, AWS Redshift, etc. The functionality supports no-code integration with mapping, validating, and merging fields on the fly.

This article covers integrating Salesforce CRM and one of the most popular cloud data warehouses, Snowflake using AppFlow.

AWS AppFlow Integration Architecture

The generic AWS AppFlow integration architecture looks like this:

AWS AppFlow integration architecture

For our use case to integrate Salesforce and Snowflake, we will dive into the following architecture:

Salesforce and Snowflake architecture


Snowflake Configuration

In order to have the configuration enabled, first we need to setup Snowflake side with an external AWS S3 stage and a warehouse.

The Snowflake integration with AWS S3 is based on a Snowflake-Created AWS IAM user:



This process starts with creating an AWS IAM policy first for our S3 bucket:

JSON
 




x


 
1
{
2
    "Version": "2012-10-17",
3
    "Statement": [
4
        {
5
            "Effect": "Allow",
6
            "Action": [
7
                "s3:PutObject",
8
                "s3:GetObject",
9
                "s3:GetObjectVersion",
10
                "s3:DeleteObject",
11
                "s3:DeleteObjectVersion"
12
            ],
13
            "Resource": "arn:aws:s3:::<s3-bucket>/*"
14
        },
15
        {
16
            "Effect": "Allow",
17
            "Action": "s3:ListBucket",
18
            "Resource": "arn:aws:s3:::<s3-bucket>",
19
            "Condition": {
20
                "StringLike": {
21
                    "s3:prefix": [
22
                        "*"
23
                    ]
24
                }
25
            }
26
        }
27
    ]
28
}



Then we will need to create an AWS IAM role and associate it with this policy:


The next step is to create a storage integration within a Snowflake WebUI worksheet:

SQL
 




x


 
1
-- Snowflake storage integration
2
CREATE STORAGE INTEGRATION snowflake_s3_integration
3
  TYPE = EXTERNAL_STAGE
4
  STORAGE_PROVIDER = S3
5
  ENABLED = TRUE
6
  STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::<snowflake-iam-role>'
7
  STORAGE_ALLOWED_LOCATIONS = ('s3://<s3-bucket>/')



We can retrieved then the necessary parameters like STORAGE_AWS_IAM_USER_ARN  and STORAGE_AWS_EXTERNAL_ID  to set up a trust relationship for the Snowflake role to AWS S3:

SQL
 




xxxxxxxxxx
1


 
1
 -- Retrieve IAM parameters for AWS S3 trusted relationship
2
 DESC INTEGRATION snowflake_s3_integration




As the final step, we need to create a stage in Snowflake WebUI worksheet:

SQL
 




x


 
1
create stage s3stage
2
  storage_integration = snowflake_s3_integration
3
  url = 's3://<s3-bucket>/';



Please find all the details about how to set up an S3 stage for Snowflake here.

AWS AppFlow Configuration

Once we are done on the destination side, we can configure AWS AppFlow.

This involves to set up both the source and destination sides, the end result will look something like this:


Salesforce as a source requires to set up the connection using Salesforce credentials, that is all.


Snowflake connection requires a bit more details such as S3 bucket, stage, DWH username and password, warehouse, and the account name.


Once the connection is established, we can define whether the AppFlow flow is running on demand (i.e. manually) or it is a scheduled process. In the can we have chosen on-demand.

Field Mapping Between Snowflake and Salesforce

For the sake of simplicity, we have created a very basic SALESFORCE_ACCOUNT table in Snowflake containing nothing more than the account name, phone, and type:


The requested field mapping can be defined in AWS AppFlow configuration. And we are ready!

Now, when we hit Run Flow button, the data flow starts and the records are going to be copied over from Salesforce Account table into Snowflake SALESFORCE_ACCOUNT table:

 

We can verify the data records loaded into Snowflake table with SELECT statements:


Conclusion

With the recent AWS AppFlow data integration service, cloud data integration is just getting easier. There is no need for code development, with fairly straightforward configuration we can easily and securely transfer data from Salesforce CRM as a system of records for our accounts and Snowflake Data Warehouse for analytics and business intelligence purposes. I am looking forward to seeing what other features and new sources and destinations will come.

AWS Data integration Amazon Web Services

Opinions expressed by DZone contributors are their own.

Related

  • Automating Storage Tiering and Lifecycle Policies in AWS S3 Using Python (Boto3)
  • AWS WAF Classic vs WAFV2: Features and Migration Considerations
  • Advanced-Data Processing With AWS Glue
  • Understanding the Power of AWS Organizations: Streamlining Cloud Management

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook