How to integrate API Gateway with SQS

前端 未结 2 539
抹茶落季
抹茶落季 2021-01-01 19:02

Just like in the title. I try to integrate API Gateway method with a SQS using cloud formation. What I am missing is the correct URI for the SQS. If any of you already did t

2条回答
  •  情书的邮戳
    2021-01-01 19:19

    I'm pretty sure the SQS role and policy should look more like this (you seem to have pasted the lambda role instead):

    SQSRole:
       Type: AWS::IAM::Role
       Properties:
        AssumeRolePolicyDocument:
         Version: '2012-10-17'
         Statement:
          - Effect: Allow
            Principal:
             Service:
              - apigateway.amazonaws.com
            Action: sts:AssumeRole
        Path: /
      SQSRolePolicy:
        Type: AWS::IAM::Policy
        DependsOn: [SQSRole]
        Description: IAM policy applied to the service role.
        Properties:
          PolicyName: send-messages-sqs
          PolicyDocument:
            Statement:
            - Action:
                - sqs:SendMessage
              Resource:
                - !Sub arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:QUEUE_NAME
              Effect: Allow
          Roles: [!Ref SQSRole]
    

提交回复
热议问题