Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting the most out of Serverless

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Getting the most out of Serverless

More Decks by Rumesh Eranga Hapuarachchi

Other Decks in Programming

Transcript

  1. Outline • Serverless & Building Blocks • General Design Principles

    • Five Excellence Pillars • Using Well Architected Tool
  2. • Speedy, Simple, Singular • Think of concurrent requests instead

    of total request • Share nothing • Assume no hardware affinity • Orchestrate using state machines instead of functions • Use events to trigger transactions • Design for failures and duplicates
  3. • Throttling ◦ Unknown access patterns ◦ Number of requests

    ◦ Enable at API Level ◦ API Keys ◦ Lambda Concurrency Controls
  4. Selection 1. Lambda a. Memory, CPU, Network, Storage IOPS (https://github.com/alexcasalboni/aws-lambda-power-tunin

    g) b. VPC if needed 2. API Gateway a. Regional and Edge endpoints 3. DynamoDB a. on-demand/provisioned b. Partitioning Strategy
  5. Optimize • Design tradeoffs and SLA requirements • API Gateway

    ◦ API Gateway, AppSync caching ◦ Content encoding for compression ▪ Minimum response size • DynamoDB ◦ DAX ◦ GSI, LSI • Lambda ◦ Higher timeouts will incur higher costs ◦ Load testing ◦ Minimize dependency complexity ◦ Global scope
  6. Optimize • Event submission with Status updates ◦ WebSockets with

    GraphQL • Image Source: Serverless Application Lens, PDF
  7. • Cost Effective Resources ◦ Pay per value ◦ Use

    when needed (DAX, Provisioned Lambda) ◦ CPU vs Execution time • Expenditure Awareness ◦ With growth, resource list will increase. ◦ AWS Cost explorer • Logging and Storage ◦ Log retention periods and archival ◦ Remove unnecessary logging
  8. • Code Optimization ◦ Global Scope ◦ Using of managed

    service features ▪ S3 full object vs Athena SQL/ S3 select Image Source: Serverless Application Lens, PDF
  9. • Metrics and Alerts ◦ CloudWatch ▪ (Cross Service and

    Per Service) Dashboards ◦ Business Metrics ▪ Application performance against business goals ◦ Customer Experience Metrics ◦ System Metrics ▪ HTTP errors, mem utilization, Throttling, integration latency ◦ Operational Metrics ▪ CI/CD Stats • Setup Alarms as needed in many levels ◦ Lambda ◦ API Gateway ◦ SQS….
  10. • Prototyping ◦ Infra as code ◦ Dedicated accounts ◦

    Configuration Management • Testing ◦ Unit, Integration, Ui ◦ Modular Code ◦ Service limits vs performance testing • Deploying ◦ Isolated Environments ◦ Infra as code ◦ SAM/Serverless ◦ Code Build, Code Deploy, Code Pipelines ◦ All at once, Blue Green, Canary
  11. • AWS_IAM authorization • Amazon Cognito user pools • API

    Gateway Lambda authorizer • Resource policies
  12. • Detective Control ◦ Log Management ◦ OWASP Dependency Check

    • Infrastructure Protection ◦ VPC ◦ Network Boundaries ◦ Dynamic Authentication for service to service communication • Data Protection ◦ API Gateway access logs ▪ Be careful about sensitive data ▪ Encrypt sensitive data ▪ Compliancy check before logging