cloud_formation_template.yaml [66:129]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Events:
        S3SelectDemoApi:
            # Define an API Gateway endpoint that responds to HTTP POST at /s3-select-demo
            Type: Api
            Properties:
                 RestApiId: !Ref ApiGatewayApi
                 Path: /s3-select-demo
                 Method: POST
                 
  ApiGatewayApi:
     Type: AWS::Serverless::Api
     Properties:
       StageName: Prod
       Variables:
        LambdaFunctionName: !Ref S3SelectLDemoLambdaFunction
  
  SqlInjDetection: 
     Type: "AWS::WAFRegional::SqlInjectionMatchSet"
     Properties: 
       Name: "Find SQL injections in the message body"
       SqlInjectionMatchTuples: 
         - 
           FieldToMatch: 
             Type: "BODY"
           TextTransformation: "NONE"
  
  SqlInjRule: 
     Type: "AWS::WAFRegional::Rule"
     Properties: 
       Name: "SqlInjRule"
       MetricName: "SqlInjRule"
       Predicates: 
         - 
           DataId: 
             Ref: "SqlInjDetection"
           Negated: false
           Type: "SqlInjectionMatch"
 
  S3SelectACL: 
     Type: "AWS::WAFRegional::WebACL"
     Properties: 
       Name: "S3SelectACL"
       DefaultAction: 
         Type: "ALLOW"
       MetricName: "S3SelectACL"
       Rules: 
         - 
           Action: 
             Type: "BLOCK"
           Priority: 3
           RuleId: 
             Ref: "SqlInjRule"
             
  MyWebACLAssociation:
     Type: "AWS::WAFRegional::WebACLAssociation"
     Properties:
       ResourceArn: !Sub arn:aws:apigateway:${AWS::Region}::/restapis/${ApiGatewayApi}/stages/Prod
       WebACLId:
          Ref: S3SelectACL
 
Outputs:
  ProdDataEndpoint:
    Description: "API Prod stage endpoint"
    Value: !Sub "https://${ApiGatewayApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/s3-select-demo"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



template.yaml [53:116]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Events:
        S3SelectDemoApi:
            # Define an API Gateway endpoint that responds to HTTP POST at /s3-select-demo
            Type: Api
            Properties:
                 RestApiId: !Ref ApiGatewayApi
                 Path: /s3-select-demo
                 Method: POST
                 
  ApiGatewayApi:
     Type: AWS::Serverless::Api
     Properties:
       StageName: Prod
       Variables:
        LambdaFunctionName: !Ref S3SelectLDemoLambdaFunction
        
  SqlInjDetection: 
     Type: "AWS::WAFRegional::SqlInjectionMatchSet"
     Properties: 
       Name: "Find SQL injections in the message body"
       SqlInjectionMatchTuples: 
         - 
           FieldToMatch: 
             Type: "BODY"
           TextTransformation: "NONE"
  
  SqlInjRule: 
     Type: "AWS::WAFRegional::Rule"
     Properties: 
       Name: "SqlInjRule"
       MetricName: "SqlInjRule"
       Predicates: 
         - 
           DataId: 
             Ref: "SqlInjDetection"
           Negated: false
           Type: "SqlInjectionMatch"
 
  S3SelectACL: 
     Type: "AWS::WAFRegional::WebACL"
     Properties: 
       Name: "S3SelectACL"
       DefaultAction: 
         Type: "ALLOW"
       MetricName: "S3SelectACL"
       Rules: 
         - 
           Action: 
             Type: "BLOCK"
           Priority: 3
           RuleId: 
             Ref: "SqlInjRule"
             
  MyWebACLAssociation:
     Type: "AWS::WAFRegional::WebACLAssociation"
     Properties:
       ResourceArn: !Sub arn:aws:apigateway:${AWS::Region}::/restapis/${ApiGatewayApi}/stages/Prod
       WebACLId:
          Ref: S3SelectACL

Outputs:
  ProdDataEndpoint:
    Description: "API Prod stage endpoint"
    Value: !Sub "https://${ApiGatewayApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/s3-select-demo"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



