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.

Serverless Ops: What do we do when the server goes away?

1,063 views

Published on

As DevOps and operations engineers, serverless provides new and exciting opportunities but will lead to uncertainty in our roles. What do we do when the server goes away?

blog: https://www.serverlessops.io/blog/serverless-ops-what-do-we-do-when-the-server-goes-away

Published in: Technology
  • Be the first to comment

Serverless Ops: What do we do when the server goes away?

  1. 1. @TMCLAUGHBOS WHAT DO WE DO WHEN THE SERVER GOES AWAY? SERVERLESS OPS
  2. 2. @TMCLAUGHBOSSERVERLESS OPS SERVERLESS!!!
  3. 3. @TMCLAUGHBOSSERVERLESS OPS SERVERLESS!!!
  4. 4. WHO IS THIS GUY UP HERE?
  5. 5. @TMCLAUGHBOSSERVERLESS OPS TOM MCLAUGHLIN: COMMUNITY ENGINEER CLOUD ZERO
  6. 6. BACKGROUND & BIASES
  7. 7. @TMCLAUGHBOSSERVERLESS OPS I LIKE STARTUPS
  8. 8. @TMCLAUGHBOSSERVERLESS OPS MY PROBLEMS MAY BE SMALLER OR DIFFERENT THAN YOURS
  9. 9. HOW DID I COME TO ASK THIS QUESTION?
  10. 10. “WOW! LAMBDA IS PRETTY COOL!”
  11. 11. “THAT DUDE IS A WALKING BILLING ALERT”
  12. 12. IT ALL CAME TOGETHER!… AND THEN FEAR SET IN.
  13. 13. "IF YOU DON’T CODE THEN YOU’RE JUST AN I.T. PERSON”
  14. 14. WHAT IS SERVERLESS?
  15. 15. @TMCLAUGHBOSSERVERLESS OPS 2007: THE CLOUD IS JUST SOMEONE ELSE’S COMPUTER
  16. 16. @TMCLAUGHBOSSERVERLESS OPS 2017: SERVERLESS STILL USES SERVERS
  17. 17. @TMCLAUGHBOS TL;DR: A SERVERLESS SOLUTION IS ONE THAT COSTS YOU NOTHING TO RUN IF NOBODY IS USING IT (EXCLUDING DATA STORAGE) Paul Johnston / @PaulDJohnston SERVERLESS OPS
  18. 18. @TMCLAUGHBOSSERVERLESS OPS CHARACTERISTICS OF SERVERLESS ▸ Little to no maintenance (no “servers” to maintain) ▸ Everything is a system ▸ Event driven ▸ Consumption (not capacity) priced ▸ You scale systems, the component pieces auto-scale
  19. 19. @TMCLAUGHBOSSERVERLESS OPS SERVERLESS COMPONENTS ▸ Functions-as-a-service (FaaS) ▸ AWS Lambda ▸ Public cloud services ▸ AWS SNS ▸ AWS SQS ▸ AWS DynamoDB ▸ AWS S3
  20. 20. @TMCLAUGHBOS “SERVERLESS” IS JUST A NAME. WE COULD HAVE CALLED IT “JEFF” Paul Johnston / @PaulDJohnston SERVERLESS OPS
  21. 21. WHERE DOES OPS FIT INTO THIS WORLD?
  22. 22. OPS WILL GO AWAY AS MUCH AS IT DID WITH THE ADOPTION OF PUBLIC CLOUD
  23. 23. MEANING IT WONT. BUT IT WILL CHANGE.
  24. 24. @TMCLAUGHBOSSERVERLESS OPS WHAT EXISTING SKILLS ARE REALLY VALUABLE? ▸ Systems engineering ▸ Building ▸ Operating ▸ Understanding ▸ Scaling ▸ Debugging ▸ Knowing how things work ▸ AWS service limits, performance, etc. ▸ Tooling ▸ Understanding how things fail
  25. 25. @TMCLAUGHBOSSERVERLESS OPS HOW WILL WE NEED TO CHANGE? ▸ YOU WILL HAVE TO CODE!
  26. 26. @TMCLAUGHBOSSERVERLESS OPS HOW THIS MIGHT PLAY OUT? ▸ New team formations ▸ Becoming a “utility player” employee
  27. 27. @TMCLAUGHBOSSERVERLESS OPS DEFINING THE OPS ROLE ON THE TEAM ▸ Developing system standards and best practices ▸ Knowing the build, deploy, and management tooling ▸ Reliability of systems ▸ Code review ▸ Performance tuning systems ▸ Evaluating costs of systems
  28. 28. DEVELOPING SYSTEM STANDARDS AND BEST PRACTICES
  29. 29. @TMCLAUGHBOSSERVERLESS OPS AWS RESOURCE PATTERNS: WEB REQUESTS
  30. 30. @TMCLAUGHBOSSERVERLESS OPS AWS RESOURCE PATTERNS: MESSAGE PASSING (SNS) ▸ Pros ▸ Extensible ▸ Guaranteed delivery ▸ Cons ▸ If subscriber fails… Oh well. ▸ Questions ▸ How many messages will be passed; how many Lambda subscriber invocations?
  31. 31. @TMCLAUGHBOSSERVERLESS OPS AWS RESOURCE PATTERNS: MESSAGE PASSING (SQS) ▸ Pros ▸ Message druability ▸ Cons ▸ SQS is not a Lambda event source ▸ Questions ▸ How do you trigger Lambda? ▸ What is your consumer profile?
  32. 32. @TMCLAUGHBOSSERVERLESS OPS AWS RESOURCE PATTERNS: MESSAGE PASSING (SNS -> SQS) ▸ Pros ▸ Durable ▸ Reliable ▸ Cons ▸ SQS cons ▸ Added cost ▸ Questions ▸ Same as SNS and SQS
  33. 33. @TMCLAUGHBOSSERVERLESS OPS AWS RESOURCE PATTERNS: MESSAGE PASSING (KINESIS) ▸ Pros ▸ Fast ▸ Reliable ▸ Cons ▸ Expensive ▸ Questions ▸ Can I afford this?
  34. 34. @TMCLAUGHBOSSERVERLESS OPS AWS RESOURCE PATTERNS: MESSAGE PASSING (LAMBDA FANOUT) ▸ Pros ▸ Fast! ▸ Cons ▸ Caller Lambda needs to handle errors ▸ Hidden service dependencies ▸ Questions ▸ How confident am I this is the best idea?
  35. 35. KNOWING THE BUILD, DEPLOY, AND MANAGEMENT TOOLING
  36. 36. @TMCLAUGHBOSSERVERLESS OPS CLOUDFORMATION / SERVERLESS FRAMEWORK / ETC.
  37. 37. @TMCLAUGHBOSSERVERLESS OPS CLOUDFORMATION / SERVERLESS FRAMEWORK / ETC. # Should be replaced by https://www.npmjs.com/package/serverless-sqs-alarms-plugin ArchiveSqsQueueAlarmStart: Type: AWS::CloudWatch::Alarm Properties: AlarmActions: - Ref: ArchiveSnsNotify AlarmName: - Fn::GetAtt: - ArchiveSqsQueueAlarmStart - QueueName AlarmDescription: 'Queue has messages' ComparisonOperator: GreaterThanThreshold Dimensions: - Name: QueueName Value: ArchiveSqsQueue EvaluationPeriods: 1 MetricName: ApproximateNumberOfMessagesVisible Namespace: AWS/SQS Period: 60 Statistic: Sum Threshold: 1
  38. 38. @TMCLAUGHBOSSERVERLESS OPS CLOUDFORMATION / SERVERLESS FRAMEWORK / ETC.class Plugin { constructor (serverless, options) { this.serverless = serverless this.hooks = { 'package:compileEvents': this.beforeDeployResources.bind(this) } } beforeDeployResources () { if (!this.serverless.service.custom || !this.serverless.service.custom['sqs-alarms']) { return } const alarms = this.serverless.service.custom['sqs-alarms'].map( data => new Alarm(data, this.serverless.getProvider('aws').getRegion()) ) alarms.forEach( alarm => alarm.ressources().forEach( ressource => { _.merge( this.serverless.service.provider.compiledCloudFormationTemplate.Resources, ressource ) } ) ) } } module.exports = Plugin
  39. 39. @TMCLAUGHBOSSERVERLESS OPS CLOUDFORMATION / SERVERLESS FRAMEWORK / ETC. custom: sqs-alarms: - queue: ArchiveSqsQueue topic: ArchiveSnsNotify name: ArchiveSqsQueueAlarmStart # optional parameter thresholds: - 1 - 50 - 100 - 500 treatMissingData: string | array[] # optional parameter
  40. 40. RELIABILITY OF SYSTEMS
  41. 41. @TMCLAUGHBOSSERVERLESS OPS SOMEONE WILL TRY AND SHIP THIS
  42. 42. @TMCLAUGHBOSSERVERLESS OPS SOMEONE WILL TRY AND SHIP THIS
  43. 43. @TMCLAUGHBOSSERVERLESS OPS YOU SHOULD BE SEEING THIS IN YOUR HEAD
  44. 44. @TMCLAUGHBOSSERVERLESS OPS SECURITY
  45. 45. CODE REVIEW
  46. 46. @TMCLAUGHBOSSERVERLESS OPS LAMBDA CODE BEST PRACTICES import boto3 import logging import os _logger = logging.getLogger(__name__) # Initialize objects outside of handler to make use of container reuse s3_client = boto3.client('s3') def handler(event, context): # Do one thing and do it well. '''Archive a a message to S3.''' # The S3 bucket name is set by deployment # framework referencing the S3 bucket resource it creates. s3_bucket_name = os.environ.get('S3_BUCKET') resp = s3_client.put_object( Body=event.get(‘Records')[0].get('Sns').get('Message').encode(), Bucket=s3_bucket_name, Key=event.get('Records')[0].get('Sns').get('Subject') ) return resp
  47. 47. @TMCLAUGHBOSSERVERLESS OPS CODE ORGANIZATION
  48. 48. @TMCLAUGHBOSSERVERLESS OPS CODE ORGANIZATION
  49. 49. PERFORMANCE TUNING SYSTEMS
  50. 50. @TMCLAUGHBOSSERVERLESS OPS SCALING AND OPTIMIZING PERFORMANCE 1,000 Users 100,000 Users
  51. 51. @TMCLAUGHBOSSERVERLESS OPS AWS X-RAY
  52. 52. EVALUATING COSTS OF SYSTEMS
  53. 53. @TMCLAUGHBOSSERVERLESS OPS APPLICATION DOLLAR MONITORING
  54. 54. WE HAVE ADAPTED BEFORE AND WE WILL ADAPT AGAIN!
  55. 55. THANK YOU! HTTP://STRAYC.AT/ SERVERLESSOPS-FEEDBACK

×