[{"data":1,"prerenderedAt":74},["ShallowReactive",2],{"pattern-apigw-cloudwatch-logs-sam":3,"pattern-group-apigw-cloudwatch-logs-sam":6},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":15,"extension":16,"framework":17,"gitHub":18,"highlight":6,"introBox":22,"language":28,"level":29,"meta":30,"patternArch":31,"patternGroup":6,"patternGroupLabel":6,"resources":52,"stem":69,"testing":70,"videoId":6,"__hash__":73},"patterns\u002Fpatterns\u002Fapigw-cloudwatch-logs-sam.json","Amazon API Gateway to Amazon CloudWatch Logs",null,{"text":8},[9],"\u003Ccode>sam delete\u003C\u002Fcode>",[11],"content\u002Fcontributors\u002Fsphoorti-poojary.json",{"text":13},[14],"\u003Ccode>sam deploy --guided\u003C\u002Fcode>","Create a REST API that proxies requests directly to Amazon CloudWatch Logs to put and get log events, without a Lambda function.","json","AWS SAM",{"template":19},{"patternPath":20,"templateFile":21},"apigw-cloudwatch-logs\u002Fsam","template.yaml",{"headline":23,"text":24},"How it works",[25,26,27],"This pattern creates an Amazon API Gateway REST API that calls Amazon CloudWatch Logs directly through an AWS service integration, with no AWS Lambda function. `POST \u002FputLog` maps to the `PutLogEvents` action and writes an event to a log stream, and `POST \u002FgetLog` maps to `GetLogEvents` and reads the events back.","API Gateway assumes an IAM role that allows only `logs:PutLogEvents` and `logs:GetLogEvents` on the one log stream the stack creates. The log group and stream are fixed in the mapping templates, so callers can't reach other logs, and the templates encode the caller's `ts` and `message` with `$input.json`, so a crafted value can't break the JSON request.","The API has no authorization, so anyone with the URL can write to and read the log stream. Use it for testing, and add IAM authorization, an Amazon Cognito user pool or a Lambda authorizer before any other use.","Integration","200",{},{"icon1":32,"icon2":37,"icon3":41,"line1":45,"line2":49},{"x":33,"y":34,"service":35,"label":36},12,45,"icon-internet","Client",{"x":38,"y":34,"service":39,"label":40},50,"apigw","Amazon API Gateway\nREST API",{"x":42,"y":34,"service":43,"label":44},88,"cloudwatch","Amazon CloudWatch\nLogs",{"from":46,"to":47,"label":48},"icon1","icon2","POST",{"from":47,"to":50,"label":51},"icon3","PutLogEvents,\nGetLogEvents",{"bullets":53},[54,57,60,63,66],{"text":55,"link":56},"Tutorial: Create a REST API with an AWS integration","https:\u002F\u002Fdocs.aws.amazon.com\u002Fapigateway\u002Flatest\u002Fdeveloperguide\u002Fgetting-started-aws-proxy.html",{"text":58,"link":59},"Amazon CloudWatch Logs API Reference - PutLogEvents","https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatchLogs\u002Flatest\u002FAPIReference\u002FAPI_PutLogEvents.html",{"text":61,"link":62},"Amazon CloudWatch Logs API Reference - GetLogEvents","https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatchLogs\u002Flatest\u002FAPIReference\u002FAPI_GetLogEvents.html",{"text":64,"link":65},"Amazon API Gateway Quotas","https:\u002F\u002Fdocs.aws.amazon.com\u002Fapigateway\u002Flatest\u002Fdeveloperguide\u002Flimits.html",{"text":67,"link":68},"Amazon CloudWatch Logs Quotas","https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002Fcloudwatch_limits_cwl.html","patterns\u002Fapigw-cloudwatch-logs-sam",{"text":71},[72],"Send \u003Ccode>POST\u003C\u002Fcode> requests with a \u003Ccode>ts\u003C\u002Fcode> and \u003Ccode>message\u003C\u002Fcode> to the \u003Ccode>PutLogUrl\u003C\u002Fcode> output, then read them back from \u003Ccode>GetLogUrl\u003C\u002Fcode>. See the README in the GitHub repo for the commands.","JiTxjTXQj-93lZhJurGnhvG12KifRqBojcWL9lZoN5I",1795189146774]