AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: HTTP API direct integrations Resources: MyQueue: Type: AWS::SQS::Queue MyHttpApi: Type: AWS::Serverless::HttpApi Properties: DefinitionBody: 'Fn::Transform': Name: 'AWS::Include' Parameters: Location: './api.yaml' MyHttpApiRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Principal: Service: "apigateway.amazonaws.com" Action: - "sts:AssumeRole" Policies: - PolicyName: ApiDirectWriteToSQS PolicyDocument: Version: '2012-10-17' Statement: Action: - sqs:SendMessage Effect: Allow Resource: - !GetAtt MyQueue.Arn MyTriggeredLambda: Type: AWS::Serverless::Function Properties: CodeUri: src/ Handler: app.lambdaHandler Runtime: nodejs12.x Policies: - SQSPollerPolicy: QueueName: !GetAtt MyQueue.QueueName Events: SQSTrigger: Type: SQS Properties: Queue: !GetAtt MyQueue.Arn Outputs: ApiEndpoint: Description: "HTTP API endpoint URL" Value: !Sub "https://${MyHttpApi}.execute-api.${AWS::Region}.amazonaws.com"