The architecture described in this blog post is intended to improve the efficiency of updating configuration data in a DynamoDB table by allowing authorized business users to make updates directly from Salesforce, rather than having to go through a manual process involving creating a support ticket.

To integrate salesforce with aws DynamoDB , the architecture makes use of two Amazon Web Services (AWS) products: Amazon AppFlow and Amazon EventBridge. These services can be used to integrate Salesforce Lightning with DynamoDB in a bi-directional manner, allowing updates to be made in either direction.

Amazon AppFlow , a fully managed integration service which enables data transfer between SaaS applications, such as Salesforce, and cloud storage or databases, such as DynamoDB. It can be used to easily set up data flows between these systems, allowing data to be transferred and transformed in real-time.

Amazon EventBridge is a fully managed event bus which makes it easy to connect applications together using data from your own applications, SaaS applications, and AWS services. It can be used to send data from one application to another, or to trigger an action in another application in response to an event.

By using these two services together, it is possible to build an event-driven, serverless-based microservice that allows authorized business users to update configuration data in DynamoDB directly from the Salesforce screen, without requiring access to the AWS Command Line Interface or AWS Management Console. This can help, streamline the process of updating configuration data and improve the efficiency of the contact center application.

AWS Salesforce and DynamoDB with AWS appflow
Credits : https://aws.amazon.com/blogs/architecture/integrating-salesforce-with-aws-dynamodb-using-amazon-appflow-bi-directionally/

Steps to integrate salesforce lightning

Here is a high-level overview of the steps you might follow to integrate Salesforce Lightning with DynamoDB using Amazon AppFlow and Amazon EventBridge:

Step 1 : Setup AWS and DynamoDB

Set up your AWS account and create a DynamoDB table to store your configuration data.

Step 2 : Salesforce account and Salesforce Lightning application

Set up your Salesforce account and create a Salesforce Lightning application to manage your configuration data.

Step 3 : Set up Amazon AppFlow

Set up Amazon AppFlow by creating a flow that transfers data between Salesforce and DynamoDB. You will need to specify the source and destination for the data, as well as any transformations or mapping that need to be applied to the data.

To set up Amazon AppFlow and create a flow that transfers data between Salesforce and DynamoDB, you will need to follow these steps:

With AWS Management Console :

With AWS CLI :

aws appflow create-flow \

    --name "My Salesforce to DynamoDB Flow" \

    --description "This flow transfers data from Salesforce to DynamoDB" \

    --source "Salesforce" \

    --destination "DynamoDB"
aws appflow create-connector-profile \

    --connector-profile-name "SalesforceConnectorProfile" \

    --flow-name "My Salesforce to DynamoDB Flow" \

    --connector-type "Salesforce" \

    --connection-mode "Private" \

    --credentials '{"username":"myusername","password":"mypassword","securityToken":"mysecuritytoken"}'
aws appflow create-connector-profile \

    --connector-profile-name "SalesforceConnectorProfile" \

    --flow-name "My Salesforce to DynamoDB Flow" \

    --connector-type "Salesforce" \

    --connection-mode "Private" \

    --credentials '{"username":"myusername","password":"mypassword","securityToken":"mysecuritytoken"}'
aws appflow create-connector-profile \

    --connector-profile-name "DynamoDBConnectorProfile" \

    --flow-name "My Salesforce to DynamoDB Flow" \

    --connector-type "DynamoDB" \

    --connection-mode "Private" \

    --credentials '{"accessKeyId":"myaccesskey","secretAccessKey":"mysecretaccesskey"}'
aws appflow create-flow-execution-property \

    --flow-name "My Salesforce to DynamoDB Flow" \

    --property-key "Transformations" \

    --property-value '{"field1": {"operation": "set", "value": "newvalue"}}'

Start the flow using the start-flow command:

aws appflow start-flow \

    --name "My Salesforce to DynamoDB Flow"

This will set up the flow to transfer data from Salesforce to DynamoDB, applying any specified transformations or mapping along the way. You can monitor the progress of the flow using the describe-flow-execution-records command.

Step 4 : Set up Amazon EventBridge

Set up Amazon EventBridge by creating an event bus and defining the events that should trigger data transfer between Salesforce and DynamoDB. You can also specify any rules that should be applied to filter or transform the data before it is transferred.

With AWS Management Console :

To set up Amazon EventBridge using the AWS Management Console, you will need to perform the following steps:

{

  "source": [

    "aws.appflow"

  ],

  "detail-type": [

    "AppFlow Export Succeeded"

  ]

}

This will set up Amazon EventBridge to trigger data transfer between Salesforce and DynamoDB whenever an AppFlow Export Succeeded event is received on the MyEventBus event bus. The data will be filtered or transformed according to the rules defined in the MyRule rule, and any additional targets specified for the rule. You can monitor the progress of the data transfer by inspecting the events received on the event bus and the results of any targets that were triggered.

With AWS CLI :

aws events create-event-bus \

    --name "MyEventBus"
event_pattern='{

  "source": [

    "aws.appflow"

  ],

  "detail-type": [

    "AppFlow Export Succeeded"

  ]

}'
aws events put-rule \

    --name "MyRule" \

    --event-pattern "$event_pattern"
aws events put-targets \

    --rule "MyRule" \

    --targets '{

        "Id": "MyTarget",

        "Arn": "arn:aws:lambda:us-west-2:123456789012:function:MyLambdaFunction",

        "Input": "{\"field1\": \"$.detail.field1\"}"

    }'

This will set up Amazon EventBridge to trigger data transfer between Salesforce and DynamoDB whenever an AppFlow Export Succeeded event is received on the MyEventBus event bus. The data will be filtered or transformed according to the rules defined in the MyRule rule, and any additional targets specified for the rule. You can monitor the progress of the data transfer by inspecting the events received on the event bus and the results of any targets that were triggered.

Step 5: Test the integration

Test the integration by making updates to the configuration data in either Salesforce or DynamoDB and verifying that the changes are reflected in the other system.

With AWS Management Console:

To test the integration between Salesforce and DynamoDB using the AWS Management Console, you will need to perform the following steps:

This will confirm that the integration between Salesforce and DynamoDB is working as expected and that data is being transferred correctly between the two systems.

With AWS CLI:

To test the integration between Salesforce and DynamoDB using the AWS CLI, you will need to perform the following steps:

aws appflow describe-flow-execution-records \

    --name "My Salesforce to DynamoDB Flow"
aws dynamodb scan \

    --table-name "MyTable"

Alternatively, you can also make updates to the configuration data in DynamoDB and verify that the changes are reflected in Salesforce.

This will confirm that the integration between Salesforce and DynamoDB is working as expected and that data is being transferred correctly between the two systems.

Step 6 : Deploy the integration

Deploy the integration to production and make it available to authorized business users.

With AWS Management Console :

To deploy the integration between Salesforce and DynamoDB to production using the AWS Management Console, you will need to perform the following steps:

(Optional) If you have not already done so, set up Amazon EventBridge to trigger data transfer between Salesforce and DynamoDB based on specific events.

(Optional) If you want to enable authorized business users to access the integration, you can do so by adding them as users in the AWS Management Console or by granting them access to the relevant resources through IAM policies.

This will make the integration between Salesforce and DynamoDB available to authorized business users in production. You can monitor the progress of the data transfer and the status of the integration using the Amazon AppFlow and Amazon EventBridge pages in the AWS Management Console.

With AWS CLI :

To deploy the integration between Salesforce and DynamoDB to production using the AWS CLI, you will need to perform the following steps:

aws appflow describe-flows

This will make the integration between Salesforce and DynamoDB available to authorized business users in production. You can monitor the progress of the data transfer and the status of the integration using the describe-flow-execution-records and list-event-buses commands, respectively.

Conclusion

This is just a high-level overview of the process, and there may be additional steps or considerations depending on your specific needs and requirements. It is also worth noting that Amazon AppFlow and Amazon EventBridge are just two options for integrating Salesforce and DynamoDB – there are other approaches and tools that you could use as well.

Leave a Reply

Your email address will not be published. Required fields are marked *