At AWS re:Invent 2018, the AWS Lambda team announced a number of new capabilities to help developers make developing serverless applications even easier. With AWS Layers, developers can easily bundle up dependencies and other bits of reusable code to simplify their management. The Runtime API allows developers to bring whatever language they want to Lambda. Lastly nested applications give developers the ability to combine whole serverless applications to allow the highest level of re-use possible. In this session we’ll go through all three of these key new capabilities and review how they can help you.
Speaker: Chris Munns - Principal Developer Advocate, AWS Serverless Applications, AWS
7. Anatomy of a Lambda function
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
8. Anatomy of a Lambda function
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Functions will then grow in complexity with business logic sub-functions
9. Anatomy of a Lambda functionImport sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Business logic sub-functions
10. Anatomy of a Lambda functionImport sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information, common helper functions
Common helper functions
Business logic sub-functions