title: How to create a private AWS Api Gateway using cloudformation?
body: <p>I am trying to create an AWS API Gateway of PRIVATE type,<br>
  This requires a resource policy, which I have as I'm able to create the gateway from the AWS Console,<br>
  I wanted to know how I could add the resource policy via the CF template -</p>
  
  <p><strong>Following is the swagger definition of the resource policy -</strong></p>
  
  <pre><code>x-amazon-apigateway-policy:
    Version: "2012-10-17"
    Statement:
    - Effect: "Deny"
      Principal: "*"
      Action: "execute-api:Invoke"
      Resource: "arn:aws:execute-api:us-east-1:awsAccountId:xxxx/*/*/*"
      Condition:
        StringNotEquals:
          aws:sourceVpc: "vpc-xxxxx"
    - Effect: "Allow"
      Principal: "*"
      Action: "execute-api:Invoke"
      Resource: "arn:aws:execute-api:us-east-1:xxxx:xxxx/*/*/*"
  </code></pre>
  
  <p><strong>How can I configure it in the CF template -</strong></p>
  
  <pre><code>AWSTemplateFormatVersion: 2010-09-09
  Transform: 'AWS::Serverless-2016-10-31'
  Description: G2G Api Template Stack
  
  Resources:
     g2gPrivate:
      Type: 'AWS::ApiGateway::RestApi'
      Properties:
        Name: 'private-gw'
        EndpointConfiguration:
          Types:
            - PRIVATE
  </code></pre>
  
  <p><strong>Reference -</strong><br>
  <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html" rel="noreferrer">https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html</a><br></p>
  
  <p><a href="https://medium.com/@cathmgarcia/conditional-resource-policy-on-aws-sam-with-inline-swagger-816ce946dbb" rel="noreferrer">https://medium.com/@cathmgarcia/conditional-resource-policy-on-aws-sam-with-inline-swagger-816ce946dbb</a></p>