title: AWS APIGateway CloudFormation specify Api Key required for method?
body: <p>I have the below CloudFormation template which creates my API Gateway (backed by Lambda). I want to enable API Keys as a requirement for one or more of these methods. I have successfully created API Keys, Usage Plans and the association between the two, but can't figure out how to actually enable the 'requires API Key' property for some of the methods. The documentation from AWS specifies an '<em>ApiKeyRequired</em>' property as a part of the <strong>AWS::ApiGateway::Method</strong> component, but my CF template doesn't have or use this component? I'm unsure how to use it considering I've never required it before? </p>
  
  <p>My template is below: </p>
  
  <pre><code>   "ServerlessRestApi": {
          "Type": "AWS::ApiGateway::RestApi",
          "Properties": {
              "Description":"This is a placeholder for the description of this web api",
              "ApiKeySourceType":"HEADER",
              "Body": {
                  "info": {
                      "version": "1.0",
                      "title": {
                          "Ref": "AWS::StackName"
                      }
                  },
                  "paths": {
                      "/list/tables": {
                          "get": {
                              "x-amazon-apigateway-integration": {
                                  "httpMethod": "POST",
                                  "type": "aws_proxy",
                                  "uri": {
                                      "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableList.Arn}/invocations"
                                  }
                              },
                              "security": [
                                  {
                                     "api_key": []
                                  }
                               ],
                              "responses": {}
                          }
                      },
                      "/list/columns/{tableid}": {
                          "get": {
                              "x-amazon-apigateway-integration": {
                                  "httpMethod": "POST",
                                  "type": "aws_proxy",
                                  "uri": {
                                      "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetColumnList.Arn}/invocations"
                                  }
                              },
                              "responses": {}
                          }
                      },
                      "datagw/general/table/get/{tableid}": {
                          "get": {
                              "x-amazon-apigateway-integration": {
                                  "httpMethod": "POST",
                                  "type": "aws_proxy",
                                  "uri": {
                                      "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableResponse.Arn}/invocations"
                                  }
                              },
                              "responses": {}
                          }
                      },
                      "/": {
                          "get": {
                              "x-amazon-apigateway-integration": {
                                  "httpMethod": "POST",
                                  "type": "aws_proxy",
                                  "uri": {
                                      "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Get.Arn}/invocations"
                                  }
                              },
                              "responses": {}
                          }
                      },
                      "/tables/{tableid}/{columnid}": {
                          "get": {
                              "x-amazon-apigateway-integration": {
                                  "httpMethod": "POST",
                                  "type": "aws_proxy",
                                  "uri": {
                                      "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableBasic.Arn}/invocations"
                                  }
                              },
                              "responses": {}
                          }
                      },
                      "securityDefinitions": {
                          "type": "api_key",
                          "name": "x-api-key",
                          "in": "header"
                        }
                  },
                  "swagger": "2.0"
              }
          }
      },
  </code></pre>