[{"data":1,"prerenderedAt":116},["ShallowReactive",2],{"pattern-lambda-web-sse-dashboard-nodejs-sam":3,"pattern-group-lambda-web-sse-dashboard-nodejs-sam":65},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":11,"deploy":13,"description":17,"extension":18,"framework":19,"gitHub":20,"highlight":24,"introBox":25,"language":32,"level":33,"meta":34,"patternArch":35,"patternGroup":49,"patternGroupLabel":6,"resources":50,"stem":60,"testing":61,"videoId":6,"__hash__":64},"patterns\u002Fpatterns\u002Flambda-web-sse-dashboard-nodejs-sam.json","Real-time metrics dashboard with Server-Sent Events on AWS Lambda Web Functions",null,{"text":8},[9,10],"Delete the function and its endpoints: \u003Ccode>aws lambda-web delete-web-function --function-name lambda-web-sse-dashboard\u003C\u002Fcode>.","See the GitHub repo for removing the execution role and log groups.",[12],"content\u002Fcontributors\u002Fjulian-wood.json",{"text":14},[15,16],"npm install","aws lambda-web deploy --name lambda-web-sse-dashboard --code . --timeout-seconds 900","Stream live metrics to the browser over server-sent events (SSE) from a zero-dependency Node.js HTTP server running as an AWS Lambda Web Function.","json","AWS SAM",{"template":21},{"patternPath":22,"templateFile":23},"lambda-web-sse-dashboard\u002Fnodejs\u002Fsam","template.yaml","true",{"headline":26,"text":27},"How it works",[28,29,30,31],"This pattern deploys a plain Node.js HTTP server as an AWS Lambda Web Function. It has no framework, no dependencies, and no build step. The server streams a metrics snapshot to the browser every 2 seconds over a single SSE connection that stays open.","A web function runs a real server process. The runtime passes the listen address in the \u003Ccode>AWS_LAMBDA_HTTP_ENDPOINT\u003C\u002Fcode> environment variable, and the server listens on it as it would anywhere else. Because the process stays alive between requests, it can hold long-lived connections open and push data to the client, which the Lambda event model cannot do.","The dashboard reports values the process measures about itself: execution environment uptime, CPU time consumed, open SSE connections, and the serving Region. Select Generate CPU load to run about 1.5 seconds of SHA-256 hashing and watch CPU time climb and fall back. The environment stays up for minutes while using a fraction of a second of CPU, because you pay for active CPU time, not time spent waiting.","Each execution environment handles many concurrent requests (64 by default, up to 128). As environments near that limit, Lambda adds more and scales back to zero when traffic falls. Optionally, deploy a second \u003Ccode>MultiRegion\u003C\u002Fcode> endpoint to get one global URL that uses Amazon Route 53 latency-based routing to serve each request from the nearest Region.","Node.js","200",{},{"icon1":36,"icon2":41,"line1":45},{"x":37,"y":38,"service":39,"label":40},20,50,"icon-internet","Browser",{"x":42,"y":38,"service":43,"label":44},70,"lambda-web-functions","AWS Lambda Web Functions",{"from":46,"to":47,"label":48},"icon1","icon2","SSE","lambda-web-sse-dashboard",{"bullets":51},[52,54,57],{"text":44,"link":53},"https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fweb-functions.html",{"text":55,"link":56},"Using Server-Sent Events (MDN)","https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FServer-sent_events\u002FUsing_server-sent_events",{"text":58,"link":59},"AWS Lambda pricing","https:\u002F\u002Faws.amazon.com\u002Flambda\u002Fpricing\u002F","patterns\u002Flambda-web-sse-dashboard-nodejs-sam",{"text":62},[63],"See the GitHub repo for detailed testing instructions.","uvAd2sZMx4Rzi0dA4zibzprSYTAnMmqj9ZUNCLIDJpo",[66,94],{"id":67,"title":5,"architectureURL":6,"cleanup":68,"contributors":70,"deploy":71,"description":17,"extension":18,"framework":73,"gitHub":74,"highlight":24,"introBox":78,"language":32,"level":33,"meta":80,"patternArch":81,"patternGroup":49,"patternGroupLabel":6,"resources":85,"stem":90,"testing":91,"videoId":6,"__hash__":93},"patterns\u002Fpatterns\u002Flambda-web-sse-dashboard-nodejs-awscli.json",{"text":69},[9,10],[12],{"text":72},[15,16],"AWS CLI",{"template":75},{"patternPath":76,"templateFile":77},"lambda-web-sse-dashboard\u002Fnodejs\u002Fawscli","index.js",{"headline":26,"text":79},[28,29,30,31],{},{"icon1":82,"icon2":83,"line1":84},{"x":37,"y":38,"service":39,"label":40},{"x":42,"y":38,"service":43,"label":44},{"from":46,"to":47,"label":48},{"bullets":86},[87,88,89],{"text":44,"link":53},{"text":55,"link":56},{"text":58,"link":59},"patterns\u002Flambda-web-sse-dashboard-nodejs-awscli",{"text":92},[63],"q3p3jolneJQZYsQsmkN0utzXNYpNI06pMIz5y0Km6aw",{"id":4,"title":5,"architectureURL":6,"cleanup":95,"contributors":97,"deploy":98,"description":17,"extension":18,"framework":19,"gitHub":100,"highlight":24,"introBox":102,"language":32,"level":33,"meta":104,"patternArch":105,"patternGroup":49,"patternGroupLabel":6,"resources":109,"stem":60,"testing":114,"videoId":6,"__hash__":64},{"text":96},[9,10],[12],{"text":99},[15,16],{"template":101},{"patternPath":22,"templateFile":23},{"headline":26,"text":103},[28,29,30,31],{},{"icon1":106,"icon2":107,"line1":108},{"x":37,"y":38,"service":39,"label":40},{"x":42,"y":38,"service":43,"label":44},{"from":46,"to":47,"label":48},{"bullets":110},[111,112,113],{"text":44,"link":53},{"text":55,"link":56},{"text":58,"link":59},{"text":115},[63],1791847087655]