简体   繁体   中英

How does AWS Step Functions invoke Lambdas?

From an architecture point of view, when an AWS Step Functions invoke a Lambda, does it go through API Gateway or does the invocation happen directly?

The AWS Step Functions service directly invokes Lambda functions - there is no need for the Step Function service to go via another AWS service to invoke a Lambda.

You can see the lambda:InvokeFunction IAM permission needed by the service, in the AWS Lambda IAM policy template within the Step Function docs. There is no permission required for the API gateway.

You also wouldn't have the option to specify the InvocationType if it went via the API Gateway.

To add to the above answer, when you create an Amazon States Language document, you can reference the ARN of the Lambda function. That is how AWS Step Functions invoke an AWS Lambda function. For example:

 {
        "Comment": "A simple AWS Step Functions state machine that automates a call center support session.",
        "StartAt": "Open Case",
        "States": {
        "Open Case": {
        "Type": "Task",
        **"Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",**
        "Next": "Assign Case"
          },
         "Assign Case": {
         "Type": "Task",
         "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
         "Next": "Send Email"
         },
         "Send Email": {
         "Type": "Task",
         "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
         "End": true
          }
          }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM