More Related Content Similar to AWS Lambda Powertools walkthrough.pdf (20) More from Heitor Lessa (8) AWS Lambda Powertools walkthrough.pdf1. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless Lens in AWS WA Tool
2. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless Lens in AWS WA Tool
Most common risks
3. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Findings come in late
Plan/design Build Ship Operate
4. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Findings come in late
Plan/design Build Ship Operate
Readiness assessment
5. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Findings come in late
Plan/design Build Ship Operate
Readiness assessment
6. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Findings come in late
Plan/design Build Ship Operate
Today, let’s fix here
7. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda Powertools
Logger
Metrics
Tracer
+ Many more
A toolkit to implement
Serverless best practices and
increase developer velocity
8. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda Powertools
OPS1 solution
OPS 1: How do you evaluate your Serverless application’s health?
9. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda Powertools
walkthrough
Heitor Lessa (he/him)
Principal Solutions Architect, Developer Acceleration (DevAx)
AWS
@heitor_lessa || lessa@amazon.com
10. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Today Up next
11. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today
12. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: Serverless Lens mapping (51%)
Question Practice
SEC 1 Scope access based on identity’s metadata
SEC 2 Design smaller, single-purpose functions
SEC 2 Use temporary credentials between resources and components
SEC 3 Store secrets that are used in your code securely
REL 1 Use mechanisms to protect nonscalable resources
REL 2 Manage transaction, partial, and intermittent failures
REL 2 Manage duplicate and unwanted events
REL 2 Orchestrate long-running transactions
OPS 1 Use distributed tracing, and code is instrumented with additional context
OPS 1 Use structured and centralized logging
OPS 1 Use application, business, and operations metrics
OPS 2 Use infrastructure as code (IaC) and stages isolated in separate environments
OPS 2 Use configuration management
PERF 1 Measure and optimize function startup time
PERF 1 Take advantage of concurrency via async and stream-based function invocations
PERF 1 Optimize access patterns and apply caching where applicable
COST 1 Minimize external calls and function code initialization
COST 1 Optimize logging output and its retention
COST 1 Use cost-aware usage patterns in code
Total 19
Powertools assistance
13. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: Scale in numbers
5 billion 161%
weekly invocations growth YoY
14. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: How did we get here?
Our customers grew
Observability
15. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: How did we get here?
Batch partial failure
REST/GraphQL API
Input/Output validation
Config management
Handling secrets
Idempotency
Observability
BYO middleware
Self-documented schemas Feature flags
Data extraction
Caching
Our customers grew
The community
grew too
~40% came from the community
Streaming
16. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: How did we get here?
Our customers grew
The community
grew too
Data engineers
Developers
Platform eng.
Security eng.
APIs, event-driven architecture
ETL, data validation
Automation, abstractions
AppSec, guardrails
17. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: Languages
Feature parity
Java
Python TypeScript .NET
18. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Today: Feature Parity Python Java TypeScript .NET
Tracer x x x x
Logger x x x x
Metrics x x x x
Event handler (REST) x
Event handler (GraphQL) x
Idempotency x x
Parameters x x
Batch processing x
Validation x x
Event source data classes x x x
Parser x
Feature flags x
Streaming x
JMESPath (data extraction) x x
Amazon SQS large
message handling
x
Feature parity
19. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Up next: What the near
future holds
20. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon CloudWatch
X-Ray
Amazon CloudWatch and AWS X-Ray
Up next
Observability providers
21. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Up next
Sensitive data masking
22. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Up next: Long-term
Lambda Powertools Powertools for AWS
23. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Demo
REST API
Data pipeline
Making critical operations idempotent
24. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
Heitor Lessa (he/him)
@heitor_lessa
25. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Appendix
26. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging
27. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Recap
Raw Semi-structured Canonical Structured
28. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Without Powertools
Raw
[INFO] 2022-12-02T22:.. 1c8df7d3… Hello world
29. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Without Powertools
[INFO] 2022-12-02T22:.. … {“message”: “Hello world”}
Semi
structured
30. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Without Powertools
Canonical
at=INFO msg=Aha! request_latency=0.1
31. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Without Powertools
Structured
32. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Without Powertools
Structured
33. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Powertools
Structured
34. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Powertools
Structured
35. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Powertools
Structured
36. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Structured logging: Powertools
Structured
37. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing
38. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API Gateway Lambda Fargate
DynamoDB
API Gateway
S3 bucket
Distributed tracing: Recap
39. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Trace
API Gateway Lambda Fargate
DynamoDB
API Gateway
S3 bucket
Distributed tracing: Recap
Legend
40. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Trace
API Gateway Lambda Fargate
DynamoDB
API Gateway
S3 bucket
Distributed tracing: Recap
Legend
Segment
41. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Trace
API Gateway Lambda Fargate
DynamoDB
API Gateway
S3 bucket
Distributed tracing: Recap
Legend
Segment
Sub-segment
42. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Trace
API Gateway Lambda Fargate
DynamoDB
API Gateway
S3 bucket
Distributed tracing: Recap
Legend
Segment
Sub-segment
Type Key Value Namespace
Annotation UserId a1c8k...
Metadata Cart {….} Checkout
Trace metadata
43. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Without Powertools
Tracing
44. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Without Powertools
Tracing
45. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Without Powertools
Tracing
46. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Without Powertools
Tracing
47. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Without Powertools
Tracing
48. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Without Powertools
Tracing
49. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed tracing: Powertools
Tracing
50. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Metrics
51. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Metrics: Recap
Namespace
Metric
Unit
Dimensions
Metrics
52. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Metrics: Without Powertools
Metrics
53. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Metrics: Powertools
Metrics
54. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Metrics: Powertools
Metrics
55. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Metrics: Powertools
Metrics
56. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda Powertools: Humble beginnings
Recap