Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What Is Happening At The Edge

229 views

Published on

Lots of things are happening in software architectures!

  • Be the first to comment

  • Be the first to like this

What Is Happening At The Edge

  1. 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is happening at the Edge? Danilo Poccia, Technical Evangelist @danilop
  2. 2. How are IT architectures evolving?
  3. 3. Client
  4. 4. Client Back End Share data
 with other clients (Database) Can’t trust the client
 (Security) Need more power (compute, storage,
 network)
  5. 5. Client Back End Business Logic Share data
 with other clients (Database) Can’t trust the client
 (Security) Need more power (compute, storage,
 network)
  6. 6. Client Back End Latency Bandwidth Business Logic Share data
 with other clients (Database) Can’t trust the client
 (Security) Need more power (compute, storage,
 network)
  7. 7. AWS Global Infrastructure Region & Number of Availability Zones New Region (coming soon)
  8. 8. Client Back End Latency Bandwidth
  9. 9. CDNClient Back End
  10. 10. Amazon CloudFront Edge Infrastructure
  11. 11. CDNClient Back End
  12. 12. CDNClient Back End
  13. 13. CDNClient Back End Devices Sensors Actuators
  14. 14. AWS IoT
  15. 15. CDNClient Back End Devices Sensors Actuators
  16. 16. CDNClient Back End Devices Sensors Actuators Latency Bandwidth Connectivity State Provisioning Group
  17. 17. CDNClient Back End Devices Sensors Actuators Gateway
  18. 18. AWS Greengrass
  19. 19. Greengrass Features Local Support for AWS Lambda Local Support for AWS IoT Devices Shadows Local Messaging Hardware Ecosystem
  20. 20. CDNClient Back End Devices Sensors Actuators Gateway
  21. 21. CDNClient Back End Devices Sensors Actuators Gateway Optimize Latency, Bandwidth, Connectivity, State Management, Software Provisioning
  22. 22. CDNClient Back End Devices Sensors Actuators Gateway Distribute & Run Custom Logic Optimize Latency, Bandwidth, Connectivity, State Management, Software Provisioning
  23. 23. CDNClient Back End Devices Sensors Actuators AWS Lambda Gateway Optimize Latency, Bandwidth, Connectivity, State Management, Software Provisioning
  24. 24. CDNClient Back End Devices Sensors Actuators ++ Amazon CloudFront AWS Lambda AWS Lambda AWS Lambda AWS Greengrass Gateway
  25. 25. CDNClient Back End Devices Sensors Actuators ++ Amazon CloudFront AWS Lambda AWS Lambda AWS Lambda AWS Greengrass Gateway
  26. 26. Greengrass Example Functions import greengrasssdk import platform from threading import Timer import time # Creating a greengrass core sdk client client = greengrasssdk.client('iot-data') my_platform = platform.platform() def greengrass_hello_world_run(): if not my_platform: client.publish(topic=‘hello/world', payload='Hello world! Sent from Greengrass Core.') else: client.publish(topic=‘hello/world’, payload='Hello world! Sent from Greengrass Core running on platform: {}'.format(my_platform)) # Asynchronously schedule this function to be run again in 5 seconds Timer(5, greengrass_hello_world_run).start() # Execute the function above greengrass_hello_world_run() # This is a dummy handler and will not be invoked def function_handler(event, context): return Long-Lived Functions (running indefinitely)
  27. 27. On-Demand Functions Greengrass Example Functions import greengrasssdk import platform import json # Creating a greengrass core sdk client client = greengrasssdk.client('iot-data') # Retrieving platform information to send from Greengrass Core my_platform = platform.platform() def function_handler(event, context): print("Received event: " + json.dumps(event, indent=2)) message = {} message['debug'] = 'I just recevied this event: {}'.format(json.dumps(event, indent=2)) if not my_platform: message['text'] = 'Hello World! Sent from Greengrass Core.' else: message['text'] = 'Hello World! Sent from Greengrass Core running on platform: {}'.format(my_platform) client.publish(topic='hello/world', payload=json.dumps(message)) return
  28. 28. Greengrass Demo
  29. 29. Greengrass Benefits Operate Offline Secure
 Communication Simplified Devices Programming Reduce the Cost of Running IoT Applications Respond to Local Events in Near Real-time
  30. 30. AWS Snowball Edge 100TB + Greengrass Core (≃ EC2 m4.4xlarge instance)
  31. 31. Snowball Edge Use Cases “Snowball Edge enables us to extend the innovative capabilities of HealthSuite, our cloud- enabled connected health ecosystem of devices, applications and digital tools supported by AWS, even when there is no network support.” Embedded Applications —Dale Wiggins, Business Leader, HealthSuite digital platform, Philips
  32. 32. Snowball Edge Use Cases “With AWS Snowball Edge, we can now collect 100 TB of data with no intermediate steps, and we can also analyze the images immediately using the onboard compute capabilities.” Remote Locations for data collection and analysis — Bob Cowen, Director of Hatfield Marine Research Center, Oregon State University
  33. 33. CDNClient Back End Devices Sensors Actuators ++ Amazon CloudFront AWS Lambda AWS Lambda AWS Lambda AWS Greengrass Gateway
  34. 34. CDNClient Back End Devices Sensors Actuators ++ Amazon CloudFront AWS Lambda AWS Lambda AWS Lambda AWS Greengrass Gateway
  35. 35. AWS Lambda@Edge Customize your content delivery while reducing load on your origin Events / Triggers Take serverless to your users
  36. 36. Lambda@Edge Event Structure { "Records": [ { "cf": { "config": { "distributionId": "EDFDVBD6EXAMPLE" }, "request": { "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", "method": "GET", "uri": "/picture.jpg", "headers": { "host": [ { "key": "Host", "value": "d111111abcdef8.cloudfront.net" } ], "user-agent": [ { "key": "User-Agent", "value": "curl/7.51.0" } ] } } } } ] } { "Records": [ { "cf": { "config": { "distributionId": "EDFDVBD6EXAMPLE" }, "request": { "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", "method": "GET", "uri": "/picture.jpg", "headers": { "host": [ { "key": "Host", "value": "d111111abcdef8.cloudfront.net" } ], "user-agent": [ { "key": "User-Agent", "value": "curl/7.18.1" } ] } }, "response": { "status": "200", "statusDescription": "OK", "headers": { "server": [ { "key": "Server", "value": "MyCustomOrigin" } ], "set-cookie": [ { "key": "Set-Cookie", "value": "theme=light" }, { "key": "Set-Cookie", "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT" } ] } } } } ] } Request Event Response Event http://amzn.to/2hunJuA
  37. 37. Creating Lambda@Edge Functions Lambda replicates the function to AWS Regions and CloudFront edge locations around the globe Replicas can't be
 edited or deleted
  38. 38. Lambda@Edge Example Functions 'use strict'; exports.handler = (event, context, callback) => { /* * Generate HTTP redirect response with 302 status code and Location header. */ const response = { status: '302', statusDescription: 'Found', headers: { location: [{ key: 'Location', value: 'http://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html', }], }, }; callback(null, response); }; cloudfront-http-redirect
  39. 39. Lambda@Edge Example Functions 'use strict'; exports.handler = (event, context, callback) => { /* * Generate HTTP response using 200 status code with a simple body. */ const response = { status: '200', statusDescription: 'OK', headers: { vary: [{ key: 'Vary', value: '*', }], 'last-modified': [{ key: 'Last-Modified', value: '2017-01-13', }], }, body: 'Example body generated by Lambda@Edge function.', }; callback(null, response); }; cloudfront-response-generation
  40. 40. Lambda@Edge Example Functions 'use strict'; exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; const headers = request.headers; if (request.uri !== '/experiment-pixel.jpg') { // do not process if this is not an A-B test request callback(null, request); return; } const cookieExperimentA = 'X-Experiment-Name=A'; const cookieExperimentB = 'X-Experiment-Name=B'; const pathExperimentA = '/experiment-group/control-pixel.jpg'; const pathExperimentB = '/experiment-group/treatment-pixel.jpg'; let experimentUri; if (headers.cookie) { for (let i = 0; i < headers.cookie.length; i++) { if (headers.cookie[i].value.indexOf(cookieExperimentA) >= 0) { console.log('Experiment A cookie found'); experimentUri = pathExperimentA; break; } else if (headers.cookie[i].value.indexOf(cookieExperimentB) >= 0) { console.log('Experiment B cookie found'); experimentUri = pathExperimentB; break; } } } if (!experimentUri) { console.log('Experiment cookie has not been found. Throwing dice...'); if (Math.random() < 0.75) { experimentUri = pathExperimentA; } else { experimentUri = pathExperimentB; } } request.uri = experimentUri; console.log(`Request uri set to "${request.uri}"`); callback(null, request); }; A/B Testing http://amzn.to/2hoarw4
  41. 41. Lambda@Edge Demo
  42. 42. Lambda@Edge Benefits Global Continuous Scaling Reduce Origin Load Subsecond Metering
  43. 43. Lambda@Edge Use Cases URL Rewrites Access Control at the Edge
  44. 44. Lambda@Edge Use Cases URL Rewrites Access Control at the Edge Response Generation At Viewer Request Remote Network Calls
  45. 45. Lambda@Edge Use Cases URL Rewrites Access Control at the Edge Response Generation At Viewer Request Remote Network Calls A/B Testing Highly Personalized Websites
  46. 46. Lambda@Edge Use Cases Demo build of a CloudFront+S3 distribution, using Lambda@Edge to secure its HTTP headers
  47. 47. CDNClient Back End Devices Sensors Actuators ++ Amazon CloudFront AWS Lambda AWS Lambda AWS Lambda AWS Greengrass Gateway
  48. 48. CDNClient Back End Devices Sensors Actuators AWS Lambda Gateway
  49. 49. Optimize your IT Architectures at the Edge Push Business Logic Closer to Users & Devices Use the Same Serverless Programming Model Create a Better User Experience for Your Customers
  50. 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank You @danilop

×