Last active
January 25, 2019 09:16
-
-
Save rujmah/dfcd0ee8054d94d093ecea0c1bd334a1 to your computer and use it in GitHub Desktop.
Revisions
-
rujmah revised this gist
Jan 25, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,4 +36,4 @@ This was apparently due to the fact that regardless of the actual `HttpMethod` w https://docs.amazonaws.cn/en_us/apigateway/latest/developerguide/set-up-lambda-custom-integrations.html > For Lambda integrations, you must use the HTTP method of POST for the integration request, according to the specification of the Lambda service action for function invocations. -
rujmah revised this gist
Jan 25, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # AWS API Gateway that calls an single endpoint Lambda with GET ## Pertinent info -
rujmah revised this gist
Jan 25, 2019 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,4 +32,8 @@ error message when attempting to use `GET` methods: </AccessDeniedException> ``` This was apparently due to the fact that regardless of the actual `HttpMethod` we set, `IntegrationHttpMethod` needs to be set to `POST` as per this piece of AWS documentation: https://docs.amazonaws.cn/en_us/apigateway/latest/developerguide/set-up-lambda-custom-integrations.html > For Lambda integrations, you must use the HTTP method of POST for the integration request, according to the specification of the Lambda service action for function invocations. The uri parameter is the ARN of the function-invoking action. -
rujmah created this gist
Jan 24, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ # AWS API Gateway that calls an single endpoint ## Pertinent info Ensure `IntegrationHttpMethod` is set to `POST` even if you want to use a `GET` (or whatever) e.g. ``` rootMethod: Type: AWS::ApiGateway::Method Properties: AuthorizationType: NONE HttpMethod: GET Integration: IntegrationHttpMethod: POST Type: AWS_PROXY Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations" ResourceId: !GetAtt apiGateway.RootResourceId RestApiId: !Ref apiGateway ``` See this thread: https://forums.aws.amazon.com/thread.jspa?messageID=745275 ## Background When attempting to set up an API Gateway with a single endpoint that used a Lambda we continually got the following error message when attempting to use `GET` methods: ``` <AccessDeniedException> <Message>Unable to determine service/operation name to be authorized</Message> </AccessDeniedException> ``` This was apparently due to the fact that regardless of the actual `HttpMethod` we set, `IntegrationHttpMethod` needs to be set to `POST` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ AWSTemplateFormatVersion: "2010-09-09" Description: Test API G setup Parameters: lambdaArn: Type: "String" Default: arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:xxxxxxxxxx Resources: apiGateway: Type: AWS::ApiGateway::RestApi Properties: Name: rjjmTestApiGateway Description: "Test API Gateway" rootMethod: Type: AWS::ApiGateway::Method Properties: AuthorizationType: NONE HttpMethod: GET Integration: IntegrationHttpMethod: POST Type: AWS_PROXY Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations" ResourceId: !GetAtt apiGateway.RootResourceId RestApiId: !Ref apiGateway deployment: Type: AWS::ApiGateway::Deployment DependsOn: rootMethod Properties: RestApiId: !Ref apiGateway StageName: v1 lambdaApiGatewayInvoke: Type: AWS::Lambda::Permission Properties: Action: lambda:InvokeFunction FunctionName: !Ref lambdaArn Principal: apigateway.amazonaws.com SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${apiGateway}/*"