1

Ich versuche, eine API-Gateway-Methode in ein SNS-Thema mit Cloudformation zu integrieren, kann aber nicht herausfinden, wie die Uri-Eigenschaft aussehen sollte.API-Gateway mit SNS mit Cloudformation integrieren

Für Lambda Anschluss sieht es so etwas wie:

"Integration": { 
     "IntegrationHttpMethod": "POST", 
     "Type": "AWS", 
     "Uri": { 
     "Fn::Join": [ 
      "", 
      [ 
      "arn:aws:apigateway:", 
      { 
       "Ref": "AWS::Region" 
      }, 
      ":lambda:path/2015-03-31/functions/", 
      { 
       "Fn::GetAtt": [ 
       "SomeLambdaFunction", 
       "Arn" 
       ] 
      }, 
      "/invocations" 
      ] 
     ] 
     } 

Wie ist das Äquivalent für SNS aussehen würde?

Antwort

0

Eine Integration Vorlage, wo Thema, Betreff und Nachricht als Anforderungsparameter eingestellt werden würde wie folgt aussehen:

ApiGatewayGETMethod: 
    Type: AWS::ApiGateway::Method 
    Properties: 
     AuthorizationType: NONE 
     HttpMethod: GET 
     RequestParameters: 
     method.request.querystring.message: false 
     method.request.querystring.subject: false 
     method.request.querystring.topic: false 
     Integration: 
     Type: AWS 
     Credentials: 
      Fn::GetAtt: [ GatewayRole, Arn ] 
     Uri: 
      Fn::Join: 
      - "" 
      - - "arn:aws:apigateway:" 
       - Ref: AWS::Region 
       - ":sns:action/Publish" 
     IntegrationHttpMethod: GET 
     RequestParameters: 
      integration.request.querystring.TopicArn: "method.request.querystring.topic" 
      integration.request.querystring.Subject: "method.request.querystring.subject" 
      integration.request.querystring.Message: "method.request.querystring.message" 
     IntegrationResponses: 
      - StatusCode: 200 
      ResponseTemplates: 
       application/json: '{"status":"OK"}' 
     MethodResponses: 
     - StatusCode: 200 
     ResourceId: 
     Fn::GetAtt: [ ApiGatewayRestApi , RootResourceId ] 
     RestApiId: !Ref ApiGatewayRestApi 

mit folgenden Syntax aufgerufen werden kann Diese Implementierung:

https://abc123456.execute-api.eu-central-1.amazonaws.com/x 
      ?topic=arn:aws:sns:eu-central-1:111111:sampletopic 
      &message=samplemesage 
      &subject=samplesubject 
Verwandte Themen