DevoxxFR 2024 Reproducible Builds with Apache Maven
管理程式對AWS LAMBDA持續交付
1. AWS Cloud Kata for Start-Ups and Developers
Taipei
Managing the Continuous Delivery
of Codes to AWS Lambda
Pahud Hsieh
2. AWS Cloud Kata for Start-Ups and Developers
What is AWS Lambda?
Challenges in serverless development
Environment pinning with API Gateway and Lambda
Continuous delivery in different scenarios
Best practices in security and development
Demo
Agenda
3. AWS Cloud Kata for Start-Ups and Developers
A bit about me
• IT Pro and developer for the past 16
years
• Chief Architect from miiiCasa Inc.
• Experienced in Serverless and ECS
across multiple AWS regions
• AWS all-5 certificates holder
4. AWS Cloud Kata for Start-Ups and Developers
What is Lambda, actually?
What is Lambda
5. AWS Cloud Kata for Start-Ups and Developers
homegrown variant of Linux container
with high speed of work routing and placement
What is Lambda
6. AWS Cloud Kata for Start-Ups and Developers
single/multiple instances
monolithic applications
What is Lambda
7. AWS Cloud Kata for Start-Ups and Developers
https://twitter.com/adrianco/status/736553530689998848
What is Lambda
8. AWS Cloud Kata for Start-Ups and Developers
API
Function
API
Function
API
Function
API
Function
API
Function
API
Function
API
Function
[micro] Application design in the cloud
9. AWS Cloud Kata for Start-Ups and Developers
• Startup and termination
• Freeze and thaw cycle
Cold Start Terminate Freeze
Thaw
Handler
Understanding Container Reuse
10. AWS Cloud Kata for Start-Ups and Developers
Challenges in Serverless Development
Challenges
11. AWS Cloud Kata for Start-Ups and Developers
Local development and testing?
Securing your credentials?
Performance tuning and optimization?
Continuous delivery?
Language constraints?
Challenges
12. AWS Cloud Kata for Start-Ups and Developers
Continuous Delivery
Continuous Delivery
13. AWS Cloud Kata for Start-Ups and Developers
local
dev/test
end-to-end
test
update
alias
Fail
publish
Serverless Development Pipelines
Log and
Monitor
Slack
Analytics
14. AWS Cloud Kata for Start-Ups and Developers
Environment Pinning with
API Gateway and Lambda
Continuous Delivery
15. AWS Cloud Kata for Start-Ups and Developers
AWS Lambda CD Relevant Features
16. AWS Cloud Kata for Start-Ups and Developers
Function Versions
• Immutable versions of functions
• Per version configuration
• Per version cloudwatch metrics
• Cloudwatch Logs with version
attribute
• Export/Download the codes
17. AWS Cloud Kata for Start-Ups and Developers
Update Function Code
• update function with local zip bundle
• always update $LATEST version of
your lambda function
18. AWS Cloud Kata for Start-Ups and Developers
Publish Version
• Publishes a version of your function
from the current snapshot of
$LATEST.
19. AWS Cloud Kata for Start-Ups and Developers
Publish Version
• update the function version to which
the alias points.
20. AWS Cloud Kata for Start-Ups and Developers
Update Alias
$LATEST(95) STABLE TESTING
94 V
93 V
92
21. AWS Cloud Kata for Start-Ups and Developers
Update Alias
$LATEST(95) STABLE TESTING
94 V V
93
92
22. AWS Cloud Kata for Start-Ups and Developers
API Gateway CD Relevant Features
24. AWS Cloud Kata for Start-Ups and Developers
API Gateway stage variables
25. AWS Cloud Kata for Start-Ups and Developers
API Gateway stage variables
26. AWS Cloud Kata for Start-Ups and Developers
Access stage variables in Lambda
27. AWS Cloud Kata for Start-Ups and Developers
Environment Pinning Table
API Gateway Lambda Custom Domain
/prod/Resources ReosurceManager:stable https://api.example.com
/dev/Resources
ReosurceManager:
$LATEST
https://dev.example.com
/qa/Resources ReosurceManager:qa https://qa.example.com
28. AWS Cloud Kata for Start-Ups and Developers
Continuous Delivery Scenarios
29. AWS Cloud Kata for Start-Ups and Developers
AWS CodeCommit and CodePipeline with Lambda
3rd Party Integrations
Continuous Delivery Scenarios
30. AWS Cloud Kata for Start-Ups and Developers
source
S3/Github
publish-to-Dev
test-Dev
release-Dev
AWS Pipeline Integration
PubNewVersion
TestNewVersion
RelNewVersion
AddItem
UpdateFunctionCode
AddItemTest
AddItemApiTest
InvokeInvoke
InvokeInvoke
Invoke
Invoke
Invoke
31. AWS Cloud Kata for Start-Ups and Developers
source
Local Laptop
3rd party integration
AddItem
UpdateFunctionCode
AddItemApiTest
Invoke
Invoke
Invoke
Runscope end-to-end testcallback
32. AWS Cloud Kata for Start-Ups and Developers
Best Practices
33. AWS Cloud Kata for Start-Ups and Developers
Securing your credentials
Leverage the nature of container reuse
Prewarm your Lambda functions
Best Practices
34. AWS Cloud Kata for Start-Ups and Developers
NEVER hardcode your credentials
35. AWS Cloud Kata for Start-Ups and Developers
Use CredentialProviderChain in AWS-SDK
https://gist.github.com/pahud/836481ae759147d3f493d3ead1f5406a
36. AWS Cloud Kata for Start-Ups and Developers
Define in API Gateway stage variables
Encrypt and save in AWS KMS
Save in S3 with Server-Side Encryption
For 3rd Party API Credentials
37. AWS Cloud Kata for Start-Ups and Developers
Leverage Container Reuse
38. AWS Cloud Kata for Start-Ups and Developers
• Startup and termination
• Freeze and thaw cycle
Cold Start Terminate Freeze
Thaw
Handler
Understanding Container Reuse
39. AWS Cloud Kata for Start-Ups and Developers
Show me the Codes!
46. AWS Cloud Kata for Start-Ups and Developers
What’s next?
A Hands-on Workshop
on AWS Infrastructure Services
Date: Sep 29, 2016
AWS 10-Minute Tutorials
“Hello, World!” technical
documents to help you get
hands-on with AWS.
47. AWS Cloud Kata for Start-Ups and Developers
Thank You!
@pahudnet