DEV Community

Cover image for Part 1: Setting Up Salesforce and AWS for Event-Driven Integration
Sandeep Sangu
Sandeep Sangu

Posted on

Part 1: Setting Up Salesforce and AWS for Event-Driven Integration

Welcome to our series on building event-driven solutions using Salesforce and AWS. In this initial post, we'll cover the essentials: creating a custom object in Salesforce, configuring named credentials, and setting up an event relay, along with preparing AWS for seamless integration.

Getting Started

Ensure you have active Salesforce and AWS accounts before we begin. Trial accounts work perfectly for the scope of this tutorial, enabling you to follow along without any upfront investment.

Quick AWS Setup Guide

  1. Sign Up for Free: Begin with a free AWS trial account and dive right in.
  2. Find Your Account Number: Just a peek at the top-right corner under your account menu and you're there.
  3. IAM User Magic: Whip up a new IAM user, granting them AmazonEventBridgeFullAccess and CloudWatchFullAccess for openers.
  4. Permissions Check: Keep it snug—only give out the permissions you need for this run-through.
  5. Secure Your Access Key: Generate, snag the download, and tuck it away safely for later.

This setup is your ticket to starting the integration adventure without weighing you down. Ready to roll?

Salesforce Setup Overview

Get your hands dirty with Salesforce by signing up for a free Developer Edition. It's the perfect playground to follow along with this guide and further your learning.

Creating a Custom Object

Dive into the Salesforce world by crafting a custom object. Here's how to bring your Employee object to life:

  1. Hop Into Salesforce: Make your way into your Salesforce or Trailhead Playground account.
  2. Object Manager Adventure: Head over to Setup and let the quick find box lead you to Object Manager.
  3. Custom Object Creation: Hit Create > Custom Object and introduce Employee to your Salesforce universe. This step magically conjures an API name Employee__c and a plural label Employees.

With these steps, you've not just created a custom object but opened a door to simulate real-world data. Time to populate Employee with some sample records and see the magic happen!

If you've followed along correctly, your screen should look something like this:

Custom Object

Fields and Relationships

Sample Records

Jazzing Up Salesforce with Named Credentials

Let's fortify the link between Salesforce and AWS using Named Credentials, akin to a digital vault for your authentication details. Here’s the step-by-step to ensure a secure connection:

  1. Navigate: In Salesforce, head to Setup and seek out Named Credentials.
  2. Create: Be guided by the prompts to forge a new Named Credential tailored for AWS integration.

🌟 Heads Up: This spotlight's on Legacy Named Credentials, akin to cherished old vinyl records. They may not last forever, so tune into the Named Credentials guide for the latest in secure connection methods.

This is akin to setting the stage for a grand performance where Salesforce and AWS integration shines brightly, ensuring a seamless and secure symphony of data and services.

Setting Up a Change Event Channel

Ready to bridge Salesforce API with Postman? Here’s how to craft a change event channel for seamless update captures:

  1. Configure Postman: First, adjust Postman to communicate smoothly with Salesforce APIs.
  2. Forge the API Link: Employ Salesforce Platform APIs to establish a channel dedicated to snagging change events. All the steps you need are neatly laid out in the Connect Postman to Salesforce guide.

🛠️ Smooth Integration: Linking Postman with Salesforce is straightforward, thanks to their straightforward documentation. This guide ensures you navigate the setup process without a hitch, laying a solid foundation for tracking changes effectively.

This approach not only sets up the technical connection but also opens the door to a more dynamic and responsive Salesforce environment.

Making Postman and Salesforce Talk

To guarantee a smooth conversation between Postman and Salesforce, here’s the path to take:

  • Step 1: Open the Communication Lines with CORS: Begin by adding necessary URLs (https://_.postman.com, https://_.postman.co) to Salesforce's CORS Allowed List to enable secure, cross-origin communication.

CORS

  • Step 2: Test the Waters: After your setup, give the connection a test to ensure everything’s operational. If all goes well, you're set for the next phase:

  • Step 3: Craft Your Message with JSON: Now comes the part where you define how Salesforce and your application talk to each other, using JSON to spell out the details for both channel setup and adding new members.

To establish the channel, use the following JSON structure



{
  "FullName": "CDC_Channel__chn",
  "Metadata": {
    "channelType": "data",
    "label": "CDC Channel"
  }
}


Enter fullscreen mode Exit fullscreen mode

For adding a member to the channel, apply this JSON configuration



{
  "FullName": "CDC_Channel_chn_EmployeeChangeEvent",
  "Metadata": {
    "eventChannel": "CDC_Channel__chn",
    "selectedEntity": "Employee__ChangeEvent"
  }
}


Enter fullscreen mode Exit fullscreen mode

⚠️ FYI: For custom objects in Salesforce, the Change Event name typically merges the object's API name with __ChangeEvent. Thus, for our Employee__c object, the correct designation would be "Employee__ChangeEvent".

With these configurations, you're not just enabling communication; you're enhancing the dialogue between Salesforce and Postman for a seamless data exchange. Let the data flow begin!

Launching the Event Relay Odyssey

Embark on setting up the "Employee Change Relay" to bridge your Salesforce with the dynamic world of Amazon EventBridge. This quest begins by marrying the relay to your crafted CDC Channel. Let's dive into the blueprint:

  • Step 1: Forge the Relay: Navigate to Setup in Salesforce, summon Event Relays from the quick find oracle, and bring to life your "Employee Change Relay," binding it with the CDC Channel.

  • Step 2: Channel Insights: Your CDC Channel stands not alone; Salesforce bequeaths a ChangeEvents standard channel, a vessel for wider explorations. Chart further into the unknown at Subscription Channels.

Standard Channel

  • Step 3: The Naming Ceremony: Upon the relay's inception, a Partner Event Source Name will emerge in its detail scroll. This name is a key to the realms of Amazon EventBridge, awaiting its revelation. Patience, as the name unveils itself, then proceed to seize it.

If you've followed along correctly, your screen should look something like this:

Event Relay

  • Step 4: Awaken the Relay: In its infancy, the relay slumbers, holding back the events from Amazon EventBridge. Awaken it by activating the partner event source in the Amazonian expanse, heralding the flow of events.

Embark on this journey with the sacred texts from Create an Event Relay in Setup, guiding you through each step with wisdom.

This odyssey not only sets the stage for an intricate dance of data but also forges a path for your integration saga to unfold. Let the currents of data flow unbridled!

Bravo! You've laid a robust foundation in Salesforce, setting the stage for a symphony of event data flowing seamlessly to AWS. But this is merely the overture in our event-driven architecture symphony.

Well done! You've now primed Salesforce for a seamless dance of data with AWS. Yet, our journey into event-driven architecture is just beginning.

➡️ Up Next in Part 2: The adventure intensifies! We'll steer through the activation of the partner event source in Amazon EventBridge, breathe life into the event relay, and orchestrate an EventBridge rule to log events in CloudWatch Additionally, we'll uncover the secrets to ensuring events are meticulously logged in the CloudWatch log group. Our quest is to forge an unbreakable bond between Salesforce and AWS, ensuring a harmonious data exchange.

See you there!

Stuck or curious? 🤔 Let's chat in the comments. I'm here to help!

Disclaimer: This journey through event-driven architecture with Salesforce and AWS is a tapestry woven from personal experiences, enriched by the diverse knowledge pool of the tech community. Our goal is to enlighten and inspire, sharing insights that resonate within our vibrant community. Any parallels with existing content are purely coincidental, underscoring the universal truths in our collective quest for knowledge. Here's to the spirit of the endless pursuit of learning.

#CommunityContributions

Top comments (1)

Collapse
 
manas86 profile image
manas86

Is it me or Part 2 is missing ?