How to apply IAM Auth to only one method of an API gateway path - SAM template
Solution 1:
As @kaustubh-khavnekar mentioned in the comments the following is required:
- Remove
DefaultAuthorizer: AWS_IAM
from theAuth
section. - Add the following to the swagger definition for the IAM protected method endpoint
post:
x-amazon-apigateway-auth:
type : "AWS_IAM"
- Add the following to the swagger definition for the unprotected method endpoint:
get:
x-amazon-apigateway-auth:
type : "NONE"