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:

  1. Remove DefaultAuthorizer: AWS_IAM from the Auth section.
  2. Add the following to the swagger definition for the IAM protected method endpoint
post:
  x-amazon-apigateway-auth:
    type : "AWS_IAM"
  1. Add the following to the swagger definition for the unprotected method endpoint:
get:
  x-amazon-apigateway-auth:
    type : "NONE"