cs-icon.svg

AWS Lambda

The AWS Lambda action connector lets you configure and execute a Lambda function that is invoked in response to an event generated in Contentstack.

Note: You need to define the Lambda function in your AWS Services console before configuring it for the Automations AWS Lambda action connector.

For instance, consider a scenario where you want to be notified whenever someone creates or updates an entry in Contentstack. In this case, you can set up a system that includes a webhook that triggers when a user creates or updates an entry. This webhook in turn must invoke a lambda function that notify a messaging service such as AWS SNS.

Set Up AWS Lambda action Connector

Perform the following steps to set up the AWS Lambda action connector:

  1. Click Configure Action Step from the left navigation panel.
  2. Click Action Step to configure third-party services.
  3. Within the Configure Action Step, click the AWS Lambda connector.
    Select_the_Connector_Lambda.png
  4. Under Choose an Action tab, select the Execute Lambda Function action.
    Choose_an_Action
  5. Click + Add New Account to add your AWS account.
    Add_Account
  6. In the Authorize pop-up window, provide details such as Title, Access Key, Secret Key, and Region.
    Authorize_Button

    You can generate the Access and Secret Access Key by navigating through Security credentials > Access Keys > Create New Access Key in your AWS console.
    api

    Additional Resource: For more information, refer to the Managing access keys for IAM users document.

  7. Once done, click Authorize.
  8. Click the Function Name textbox and select the required lambda function from the Lookup dropdown.

    Note: You need to have your Lambda function defined in your AWS Services console before configuring your AWS Lambda action connector in Automations.


    Function_Name
  9. Click the Invocation Type textbox and select an option from the given dropdown. Here, you can choose from three options: Event, RequestResponse, and DryRun.
    1. Event: This returns a request ID and status code after successful execution of the function.
    2. RequestResponse: This returns a status code and a response message as body for the selected lambda function.
    3. DryRun: This allows you to test the function, and it returns a request ID and status code.
  10. Lets select Event as the invocation type for our first example, then we will cover other invocation types proceeding further.

    Event_Invocation_Type
  11. [Optional] You can choose to add optional fields by clicking on the Show optional fields toggle. You will find two additional fields have appeared: Parameters and Specific Version or Tag.
  12. Click the Parameters textbox to add dynamic parameters to your Lambda function. Make sure to enter the parameter in JSON format only.
    You can also specify a Specific Version or Tag for your Lambda function.
    Show_optional_Fields_Event
  13. Once done, click Proceed.
  14. Click Test Action to test the configured action connector.
    Test_Action
  15. After successful execution, you will get a Request ID and status code for your Lambda function. Click Save and Exit to finish the process.
    Save_Exit

Now, in continuation to step 7 above, lets check out the output for the Invocation types RequestResponse and DryRun.

Invocation Type: RequestResponse
After performing steps 1-6 from above, perform the following steps:

  1. Select RequestResponse as the Invocation Type.
    RequestResponse_Event
  2. [Optional] Click the Show optional fields toggle.
    Add dynamic parameters (in JSON format) to your Lambda function under the Parameters textbox. And, specify a Specific Version or Tag for your Lambda function if need be.
    RequestResponse_Show_Optional_Fields

  3. Once done, click Proceed.
  4. Click Test Action to test the configured action connector.
    Test_Action

  5. After successful execution, you will get a status code and a response message (body) for your Lambda function. Click Save and Exit to finish setting up your connector.
    Save_Exit_RequestResponse

Invocation Type: DryRun
After performing steps 1-6 that we covered under setting up the Event invocation type, perform the following steps:

  1. Select DryRun as the Invocation Type.
    Select_DryRun_Event
  2. [Optional] Click the Show optional fields toggle.
    Add dynamic parameters (in JSON format) to your Lambda function under the Parameters textbox. And, specify a Specific Version or Tag for your Lambda function if need be.
    Show_Optional_Fields_DryRun
  3. Once done, click Proceed.
  4. Click Test Action to test the configured action connector.
    Test_Action
  5. After successful execution, you will get a Request ID and status code for your Lambda function. Click Save and Exit to finish the process.
    Save_Exit_DryRun

This sets the AWS Lambda action connector.

Was this article helpful?
^