title: Problems with AWS Lambda function invocation policy with permission via SDK
body: <p>I am having a very strange issue. I am using boto3 to create an API Gateway proxy to a Lambda function. I can create the Method in the API Gateway console, it informs me that the API Gateway will be given permission to invoke the function. This works great.</p>
  
  <p>However, if I create the API Gateway Method using the SDK (<code>lambda.add_permission</code>), I get this exception:</p>
  
  <pre><code>Execution failed due to configuration error: Invalid permissions on Lambda function
  </code></pre>
  
  <p>I have confirmed that the policy I create is absolutely identical to the one created by the console wizard so I am very confused as to what is happening and why the function cannot be invoked by the API. Here is the permission I am attaching:</p>
  
  <pre><code>{
      "Policy": "{\"Version\":\"2012-10-17\",\"Id\":\"default\",\"Statement\":[{\"Sid\":\"1ac63c2c972f3cbdbcf0f4b0038133e2\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"apigateway.amazonaws.com\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:REGION:ACCOUNT:function:FUNCTION_NAME\",\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\":\"arn:aws:execute-api:REGION:ACCOUNT:API_ID/*/*/*\"}}}]}"
  }
  </code></pre>
  
  <p>It seems like other people have had similar problems, but these solutions are what I already tried:</p>
  
  <p><a href="https://forums.aws.amazon.com/thread.jspa?threadID=217254&amp;tstart=0" rel="nofollow noreferrer">https://forums.aws.amazon.com/thread.jspa?threadID=217254&amp;tstart=0</a></p>