Fortinet black logo

Cookbook

AWS Lambda action

Copy Link
Copy Doc ID 5ede200c-a21f-11eb-b70b-00505692583a:545113
Download PDF

AWS Lambda action

AWS Lambda functions can be called when an automation stitch is triggered.

To configure an AWS Lambda function automation stitch in the GUI:
  1. Go to Security Fabric > Automation.
  2. Click Create New.
  3. Enter a name for the stitch, and select the FortiGate devices that it will be applied to.
  4. Select a trigger, such as Security Rating Summary.
  5. Select AWS Lambda Function and configure its settings.

    Name

    The action name.

    Delay

    The amount of time after the previous action before this action executes, in seconds (0 - 3600, default = 0).

    API gateway

    The API gateway URL, in the format:

    {restapi-id}.execute-api.{region}.{domain}/{stage}/{path}

    The CLI must be used to manually enter the individual parameters.

    API key

    The API key configured in your API gateway.

    HTTP header

    The HTTP request header name and value. Multiple headers can be added.

    +

    Click to add another action.

    Actions can be reorganized as needed by dragging and dropping.

    Name

    The action name.

    Delay

    The amount of time after the previous action before this action executes, in seconds (0 - 3600, default = 0).

  6. Click OK.
To configure an AWS Lambda function automation stitch in the CLI:
  1. Create an automation action:
    config system automation-action
        edit "aws-action-1"
            set action-type aws-lambda
            set aws-api-id "0100032001"
            set aws-region "us-east-2"
            set aws-api-stage "default"
            set aws-api-path "jkato-automation-FGT-lambda002"
            set aws-api-key ENC nx8q83OxafVTdmAKv77GIdLYthROoRXmtYsrpF4wtuvfIMlSHvHxE9EYo8W/jquj0p5GRsZOMDrgG1zB0oUq7bvoguLUa/Jx4IV0DgwzOWRUruoWEIIHQBHJWSnnrswbw1O0Px+p3uz4azh4XkR+Vi+U8/ngGoLKLtwWHn53Oa4YbK7w+mKz1BJVV+DlbCfDkPmPkA==
        next
    end
  2. Create an automation trigger:
    config system automation-trigger
        edit "auto-aws"
            set event-type security-rating-summary
        next
    end
  3. Create the automation stitch:
    config system automation-stitch
        edit "auto-aws"
            set trigger "auto-aws"
            set action "aws-action-1"
        next
    end

When the automation stitch is triggered, the FortiGate shows the stitch trigger time:

In AWS, the log shows that the function was called, executed, and finished.

AWS Lambda action

AWS Lambda functions can be called when an automation stitch is triggered.

To configure an AWS Lambda function automation stitch in the GUI:
  1. Go to Security Fabric > Automation.
  2. Click Create New.
  3. Enter a name for the stitch, and select the FortiGate devices that it will be applied to.
  4. Select a trigger, such as Security Rating Summary.
  5. Select AWS Lambda Function and configure its settings.

    Name

    The action name.

    Delay

    The amount of time after the previous action before this action executes, in seconds (0 - 3600, default = 0).

    API gateway

    The API gateway URL, in the format:

    {restapi-id}.execute-api.{region}.{domain}/{stage}/{path}

    The CLI must be used to manually enter the individual parameters.

    API key

    The API key configured in your API gateway.

    HTTP header

    The HTTP request header name and value. Multiple headers can be added.

    +

    Click to add another action.

    Actions can be reorganized as needed by dragging and dropping.

    Name

    The action name.

    Delay

    The amount of time after the previous action before this action executes, in seconds (0 - 3600, default = 0).

  6. Click OK.
To configure an AWS Lambda function automation stitch in the CLI:
  1. Create an automation action:
    config system automation-action
        edit "aws-action-1"
            set action-type aws-lambda
            set aws-api-id "0100032001"
            set aws-region "us-east-2"
            set aws-api-stage "default"
            set aws-api-path "jkato-automation-FGT-lambda002"
            set aws-api-key ENC nx8q83OxafVTdmAKv77GIdLYthROoRXmtYsrpF4wtuvfIMlSHvHxE9EYo8W/jquj0p5GRsZOMDrgG1zB0oUq7bvoguLUa/Jx4IV0DgwzOWRUruoWEIIHQBHJWSnnrswbw1O0Px+p3uz4azh4XkR+Vi+U8/ngGoLKLtwWHn53Oa4YbK7w+mKz1BJVV+DlbCfDkPmPkA==
        next
    end
  2. Create an automation trigger:
    config system automation-trigger
        edit "auto-aws"
            set event-type security-rating-summary
        next
    end
  3. Create the automation stitch:
    config system automation-stitch
        edit "auto-aws"
            set trigger "auto-aws"
            set action "aws-action-1"
        next
    end

When the automation stitch is triggered, the FortiGate shows the stitch trigger time:

In AWS, the log shows that the function was called, executed, and finished.