SlideShare a Scribd company logo
Serverless Architecture: Overview
Ganesh Samarthyam
ganesh@codeops.tech
Organizer: India Serverless Summit
www.inserverless.com
Are you dealing with web-servers, app-
servers, session and entity beans, …: in
short, are you a stone-age programmer?
Greek characters
are scary!
The term “lambda” originates
from the “lambda
calculus” (yes, yes, that same
scary math stuff!)
He he, but lambdas
are fun, not scary
def main(args):
name = args.get("name", "stranger")
greeting = "Hello " + name + "!"
print(greeting)
return {"greeting": greeting}
Lambda
functions!
import com.amazonaws.services.lambda.runtime.Context;
public class helloworld {
public String handleRequest(String name, Context context) {
String greetings = "Hello " + name;
context.getLogger().log("Name: " + name);
System.out.println(greetings);
return greetings;
}
}
function main() {
return {payload: 'Hello world'};
}
Python
Java
JavaScript (Node.JS)
But what are
lambdas?
Lambdas is just a fancy
name for stateless
functions without side-
effects!
Evolution: Servers to serverless
Code
Runtime
OS
Hardware
Code
Runtime
OS
Hardware
Code
Runtime
OS
Hardware
Code
Runtime
OS
Hardware
Physical
Servers
Virtual
Machines
Containers Serverless
Evolution: Servers to serverless
Slow-iteration and
deployment
Faster-iteration and
deployment
Fastest-iteration
and deployment
Rapid iteration and
deployment
Single tenency Multi-tenency
Super multi-
tenancy
Extreme multi-
tenancy
Unfriendly for
polyglots
Somewhat friendly
for polyglots
Friendly for
polyglots
Very friendly for
polyglots
Deploy in weeks Deploy in minutes Deploy in seconds
Deploy
independently
Typically alive for
years
Typically alive for
weeks
Typically alive for
hours
Typically alive for
seconds
Physical
Servers
Virtual
Machines
Containers Serverless
Source: https://www.slideshare.net/AmazonWebServices/getting-started-with-serverless-architectures-63429092
What is
server-“lesssss…"?
What is serverless?
“Serverless architectures refer to applications that
significantly depend on third-party services (knows
as Backend as a Service or "BaaS") or on custom code
that's run in ephemeral containers (Function as a
Service or “FaaS”)”
- Martin Fowler
– Serverless for Dummies
“Serverless: just put your code in cloud and run it”
What is serverless?
❖ Serverless is often referred to as FaaS - Function as a
Service. Gartner refers to it as fPaaS - function Platform
as a Service.
❖ The model in serverless architecture is this: a distributed
system that reacts to events or process workloads
dynamically based on demand by spinning up
ephemeral (short-lived) containers or computational
resources in the cloud.
Serverless - example
On the term “lambda”
On the term “lambda”
❖ The term “lambda” originates from the
“lambda calculus”. In 1936, Alonzo Church
developed a logic system that was later
adopted for computation.
❖ Most languages (including Java, C# and C++)
support lambda functions today.
❖ In languages supporting lambda functions,
it is an unnamed function that takes input
coming variables and returns a value.
❖ A salient characteristic of lambda functions
is the lack of side-effects.
Look ma, no servers!
Unix pipes - 1973!
– Doug McIlroy
“Write programs that do one thing and do it well.
Write programs to work together. Write programs
to handle text streams, because that is a universal
interface.”
But, but, “Serverless != No servers”
Lambdas are executed in servers in cloud
- so we still have servers!
What serverless means is you don't have to
care about servers: no provisioning,
maintenance, etc.
Why serverless?
– Google Cloud Functions
https://cloud.google.com/functions/
“Serve users from zero to
planet-scale, all without
managing any
infrastructure.”
– Gartner
"By 2022, most platform as a service (PaaS)
offerings will evolve to a fundamentally serverless
model, rendering the cloud platform architectures
dominating in 2017 as legacy architectures" 
No server upgrades
No provisioning
No procurement approvals
Serverless - characteristics
granular payment event-driven
self-managed scale on demand
Self-managed
Scale-on-demand
Real pay-as-you-go model
Event driven style
Serverless - some use cases
mobile back-ends Real-time analytics
data processing static-websites
live-video stream
processing
chatbots
Data processing
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-serverless-architectures-cmp211
Static websites
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-serverless-architectures-cmp211
Mobile backends
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-serverless-architectures-cmp211
Real-time analytics
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-serverless-architectures-cmp211
Live video-steam processing
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-serverless-architectures-cmp211
Use case #1: web applications
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
Use case #2: batch processing
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
Use case #3: stream processing
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
Lambda architecture style
source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
Towards LessOps model?
Serverless frameworks move us towards LessOps model - meaning no or
few operators are required for monitoring and maintaining the servers and
infrastructure.
– Dr Werner Vogels (Amazon CTO)
"What we’ve seen is a
revolution where complete
applications are being stripped
of all their servers, and only
code is being run. Quite a few
companies are ripping out big
pieces of their applications and
replacing their servers, their
VMs and their containers with
just code… Perhaps we no longer
have to think about servers!”
Popular technologies
AWS Lambda
Google Cloud
Functions
IBM/Adobe/
Apache OpenWhisk
Azure Functions
Five principles for serverless applications
Use a compute service to execute code on demand (no
servers)
Write single-purpose stateless functions
Design push-based, event-driven pipelines
Create thicker, more powerful front ends
Embrace third-party services
Source: Peter Sbarski, “Serverless Architectures on AWS”, Manning, 2017
Using AWS Lambda
AWS Lambda
From https://aws.amazon.com/
AWS Lambda
❖ Lambda is one of the earliest technologies for serverless
(13 Nov 2014). It is also the most mature and stable
platform.
❖ http://aws.amazon.com/lambda
❖ Currently supported (as on June 2017) - .NET Core 1.01.
(C#), Java 8, Node.js 4.3, Node.js 6.10.2, Python 2.7 and
3.6.
Three ways to create a function
❖ There are three ways to create the same lambda
function:
❖ AWS Lambda console (web UI)
❖ AWS CLI (from your commandline)
❖ AWS SDK
Execution Environment
❖ Public Amazon Linux AMI version (AMI name: amzn-ami-
hvm-2016.03.3.x86_64-gp2)
❖ Linux kernel version – 4.4.51-40.60.amzn1.x86_64
❖ When creating native (64-bit) binaries for executing in Lambda, this
information is important - so that code can be compiled to this target
❖ The following libraries are available in execution environment
❖ AWS SDK – AWS SDK for JavaScript version 2.45.0
❖ AWS SDK for Python (Boto 3) version 1.4.4, Botocore version 1.5.43
❖ Amazon Linux build of java-1.8.0-openjdk for Java
Source: http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
A simple lambda
$ cat hello.py
def lambda_handler(event, context):
print "hello srushit"
return 'Hello from srushit'
$ zip -r hello-world hello.py
$ aws lambda create-function --region us-east-1 --function-name
FirstPythonLambda --zip-file fileb:///Users/gsamarthyam/hello-world.zip --
role arn:aws:iam::431635030606:role/LambdaExecuteRole --runtime
python2.7 --handler hello::lambda_handler
Notes:
(a) Once you upload the function from command-line, it takes time to see the
updated source code from the AWS console online.
(b) In Python, print statements and Logger functions in the logging module are
logged - you can check them in CloudWatch logs.
A hello world lambda in Java
$ cat Hello.java
import com.amazonaws.services.lambda.runtime.Context;
public class Hello {
public String handleRequest(String name, Context context) {
return "Hello " + name;
}
}
http://docs.aws.amazon.com/lambda/latest/dg/java-programming-model.html
A simple lambda
hello::handleRequest
Input string
“Ganesh”
Context object
Result string
“Hello Ganesh”
AWS Lambda
Execution on a
Linux container
Step #1
$ javac -cp ./lib/aws-lambda-java-core-1.0.0.jar:./lib/aws-lambda-java-events-1.0.0.jar
Hello.java
$
Need to provide the dependencies (Context
class in this case) to compile it; dependency
details available from: https://github.com/
aws/aws-lambda-java-libs
(“Official mirror for interface definitions and
helper classes for Java code running on the AWS
Lambda platform.”)
Step #2
$ zip -r Hello.zip Hello.class lib/aws-lambda-java-core-1.0.0.jar lib/aws-lambda-java-
events-1.0.0.jar
adding: Hello.class (deflated 35%)
adding: lib/aws-lambda-java-core-1.0.0.jar (deflated 39%)
adding: lib/aws-lambda-java-events-1.0.0.jar (deflated 27%)
$ ls -lh Hello.zip
-rw-r--r-- 1 gsamarthyam staff 14K Jun 19 15:01 Hello.zip
$ ls -lh lib
-rw-r--r-- 1 gsamarthyam staff 29K Jun 23 16:12 aws-lambda-java-core-1.0.0.jar
-rw-r--r--@ 1 gsamarthyam staff 11K Jun 18 16:44 aws-lambda-java-events-1.0.0.jar
Create a zip file with the dependencies - in this
case, it is just a couple of standard dependencies
Step #3
$ aws lambda create-function --region us-east-1 --function-name FirstJavaLambda --zip-file fileb:///Users/
gsamarthyam/serverless/Hello.zip --role arn:aws:iam::431635030606:role/LambdaExecuteRole --handler
Hello::handleRequest --runtime java8
{
"TracingConfig": {
"Mode": "PassThrough"
},
"CodeSha256": "DpRB5zFF1ORVw6tTSIMprA1BgGNmpf+oGBFBy8/APWo=",
"FunctionName": "FirstJavaLambda",
"CodeSize": 13988,
"MemorySize": 128,
"FunctionArn": "arn:aws:lambda:us-east-1:431635030606:function:FirstJavaLambda",
"Version": "$LATEST",
"Role": "arn:aws:iam::431635030606:role/LambdaExecuteRole",
"Timeout": 3,
"LastModified": "2017-06-23T10:50:02.582+0000",
"Handler": "Hello::handleRequest",
"Runtime": "java8",
"Description": ""
}
Step #4
$ aws lambda invoke --invocation-type RequestResponse --function-name FirstJavaLambda
--region us-west-2 --log-type Tail --payload '"Ganesh"' outputfile.txt
{
"LogResult":
"U1RBUlQgUmVxdWVzdElkOiBmYzM2N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZmY
gVmVyc2lvbjogJExBVEVTVApsb2cgZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29udGl
udWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnIgCiB0aGlzIGlzIGNvbn
RpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogdGh
pcyBpcyBjb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IGZjMzY3YjY
0LTU4MDEtMTFlNy1iOWU5LTk5NDM2ZTg4MTJmZgpSRVBPUlQgUmVxdWVzdElkOiBmYzM2
N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZmYJRHVyYXRpb246IDI2MC45MyBtcwlC
aWxsZWQgRHVyYXRpb246IDMwMCBtcyAJTWVtb3J5IFNpemU6IDEyOCBNQglNYXggTWVtb3
J5IFVzZWQ6IDQwIE1CCQo=",
"StatusCode": 200
}
$ cat outputfile.txt
"Hello Ganesh. log stream = 2017/06/23/[$LATEST]680db95163b346579ce89f51535db346"
Step #4
$ echo
"U1RBUlQgUmVxdWVzdElkOiBmYzM2N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZm
YgVmVyc2lvbjogJExBVEVTVApsb2cgZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29ud
GludWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnIgCiB0aGlzIGlzIGNv
bnRpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogd
GhpcyBpcyBjb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IGZjMzY3Y
jY0LTU4MDEtMTFlNy1iOWU5LTk5NDM2ZTg4MTJmZgpSRVBPUlQgUmVxdWVzdElkOiBmY
zM2N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZmYJRHVyYXRpb246IDI2MC45MyBt
cwlCaWxsZWQgRHVyYXRpb246IDMwMCBtcyAJTWVtb3J5IFNpemU6IDEyOCBNQglNYXggT
WVtb3J5IFVzZWQ6IDQwIE1CCQo=" | base64 --decode
START RequestId: fc367b64-5801-11e7-b9e9-99436e8812ff Version: $LATEST
log data from stdout
this is continuation of system.out
log data from stderr
this is continuation of system.err
log data from LambdaLogger
this is continuation of logger.logEND RequestId: fc367b64-5801-11e7-b9e9-99436e8812ff
REPORT RequestId: fc367b64-5801-11e7-b9e9-99436e8812ff	 Duration: 260.93 ms	 Billed
Duration: 300 ms 	 Memory Size: 128 MB	 Max Memory Used: 40 MB
Step #4
$ aws lambda get-function --function-name FirstJavaLambda
{
"Code": {
"RepositoryType": "S3",
"Location": "https://prod-04-2014-tasks.s3.amazonaws.com/snapshots/431635030606/FirstJavaLambda-961856c8-8808-4d77-aa26-
bde4c62745d9?X-Amz-Security-
Token=FQoDYXdzENP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDJIA1ZghlrarR%2FS8sCK3A9ic4dl6r2QeYmybaLJ%2FR4VxX3e%2BN8413pI
vMLfpND96fpnK5g55zaaI4nQkYcW70zwZu9mZ3%2FXrQqObP1PKpY1BBr0uP7BrDn8wF062XuBQG4AMaoxBQ44cSvUC8cr%2FGVU2MpAzFEK0
0kgOtI9fax%2FB6eAt5xzKN2Zt4SpCtFktfaNTq15Vxm2RIk8s30Yw53jte7fPPtaUZPJZT4%2F872zNrylxSfKAfRdOvrv4%2FvGur21evlliheJ0mriQZ
NBcRkRsNWIC6MkG48inkiRL4AjWN9BNWXl5JhpPxgHfZTEnb2st1SJuuJdx3SyWs2u8Wh8J%2BV90eyuZSqDeXXRQCmk4QNhSalvLboN6M9oTC
VBh7uMdsLDkxje3FOlRdDYMJW9kcyMc%2BcqUOeeeO46m7ky0t%2BKtvDrY887jjziG3PTQjZrFPwmiEHgVImzhfa9RN8eAXb3xcnPqC97rzOM1GZ
kAD%2BuJbECu%2B1t7H93rhG5ObQZVBT4llxBq%2BQXpI0FHjqpVE7wOs7hEuqws65gXxVOltBVHv7TwsTIxibH88uai%2BpyRV%2BC6NUK%2FpL
QZDF8wCqozh%2B%2FHvmAo2smzygU%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20170623T110025Z&X-Amz-
SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=ASIAIHFSB5YQLFLCC34Q%2F20170623%2Fus-east-1%2Fs3%2Faws4_request&X-
Amz-Signature=af988a347e62ebf6fe89d3593b68ada63be6bcd74f6b12222b96b762c7204924"
},
"Configuration": {
"TracingConfig": {
"Mode": "PassThrough"
},
"Version": "$LATEST",
"CodeSha256": "DpRB5zFF1ORVw6tTSIMprA1BgGNmpf+oGBFBy8/APWo=",
"FunctionName": "FirstJavaLambda",
"MemorySize": 128,
"CodeSize": 13988,
"FunctionArn": "arn:aws:lambda:us-east-1:431635030606:function:FirstJavaLambda",
"Handler": "Hello::handleRequest",
"Role": "arn:aws:iam::431635030606:role/LambdaExecuteRole",
"Timeout": 3,
"LastModified": "2017-06-23T10:50:02.582+0000",
"Runtime": "java8",
"Description": ""
}
}
How to update the function?
$ aws lambda update-function-code --function-name arn:aws:lambda:us-
east-1:431635030606:function:FirstJavaLambda --zip-file fileb://Hello.zip
{
"TracingConfig": {
"Mode": "PassThrough"
},
"CodeSha256": "DpRB5zFF1ORVw6tTSIMprA1BgGNmpf+oGBFBy8/APWo=",
"FunctionName": "FirstJavaLambda",
"CodeSize": 13988,
"MemorySize": 128,
"FunctionArn": "arn:aws:lambda:us-east-1:431635030606:function:FirstJavaLambda",
"Version": "$LATEST",
"Role": "arn:aws:iam::431635030606:role/LambdaExecuteRole",
"Timeout": 3,
"LastModified": "2017-06-23T13:34:05.408+0000",
"Handler": "Hello::handleRequest",
"Runtime": "java8",
"Description": ""
}
How to delete the function?
$ aws lambda delete-function --function-name FirstJavaLambda
$ aws lambda list-functions | grep FirstJavaLambda
$
You can check that once the lambda is deleted,
the list-functions doesn’t list it anymore
Available commands in “aws lambda”
• add-permission
• create-alias
• create-event-source-mapping
• create-function
• delete-alias
• delete-event-source-mapping
• delete-function
• get-account-settings
• get-alias
• get-event-source-mapping
• get-function
• get-function-configuration
• get-policy
• help
• invoke
• invoke-async
• list-aliases
• list-event-source-mappings
• list-functions
• list-tags
• list-versions-by-function
• publish-version
• remove-permission
• tag-resource
• untag-resource
• update-alias
• update-event-source-mapping
• update-function-code
• update-function-configuration
Using AWS SDK to create lambdas
$ cat testing.py
def lambda_handler(event, context):
return 'Hello from Lambda'
$ cat invokelambda.py
import boto3
import json
client = boto3.client('lambda')
response = client.invoke(
FunctionName='arn:aws:lambda:us-east-1:431635030606:function:testing',
InvocationType='RequestResponse',
LogType='Tail',
Payload=json.dumps({})
)
result = response['Payload'].read()
print(result)
$ python invokelambda.py
"Hello from Lambda"
$
Kinds of lambda invocations
• Event based lambdas
are invoked based on
triggers; example: when
a file is dropped in a S3
bucket, a lambda may
be invoked
• Async in nature
• No response sent back
to the invoker
Event RequestResponse
• Synchronous - when
invoked, it executes and
waits till completion
and returns something
to the invoker
• Happens when invoked
through API gateway,
CLI or AWS console
Specifying invocation types in CLI
Help description for —invocation-type option
for “aws lambda invoke” from AWS CLI
Using base64
❖ Sometimes it is convenient to use base64 whenever you
want to send data to the lambda or return from the
lambda, or get that data again as context. this avoids
adding unicode characters etc.
❖ Logs in lambdas often use base64. You can use the
“base64 --decode” command (mac/linux) to read the
log file
Using base64 - example
$ cat logresult.txt
{
"LogResult":
"U1RBUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMgVmVyc2lvbjogJExBVEVTVApsb2c
gZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29udGludWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnI
gCiB0aGlzIGlzIGNvbnRpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogdGhpcyBpcyB
jb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IDJkZGYyNDc2LTU4MTctMTFlNy1hYjhhLTZkZDBlYzFhMWV
iYwpSRVBPUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMJRHVyYXRpb246IDUuMDIgbXM
JQmlsbGVkIER1cmF0aW9uOiAxMDAgbXMgCU1lbW9yeSBTaXplOiAxMjggTUIJTWF4IE1lbW9yeSBVc2VkOiA0NiBNQgkK",
"StatusCode": 200
}
$ echo
"U1RBUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMgVmVyc2lvbjogJExBVEVTVApsb2c
gZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29udGludWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnI
gCiB0aGlzIGlzIGNvbnRpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogdGhpcyBpcyB
jb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IDJkZGYyNDc2LTU4MTctMTFlNy1hYjhhLTZkZDBlYzFhMWV
iYwpSRVBPUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMJRHVyYXRpb246IDUuMDIgbXM
JQmlsbGVkIER1cmF0aW9uOiAxMDAgbXMgCU1lbW9yeSBTaXplOiAxMjggTUIJTWF4IE1lbW9yeSBVc2VkOiA0NiBNQgkK" |
base64 --decode
START RequestId: 2ddf2476-5817-11e7-ab8a-6dd0ec1a1ebc Version: $LATEST
log data from stdout
this is continuation of system.out
log data from stderr
this is continuation of system.err
log data from LambdaLogger
this is continuation of logger.logEND RequestId: 2ddf2476-5817-11e7-ab8a-6dd0ec1a1ebc
REPORT RequestId: 2ddf2476-5817-11e7-ab8a-6dd0ec1a1ebcDuration: 5.02 msBilled Duration: 100 ms
Memory Size: 128 MB Max Memory Used: 46 MB
$
Understanding the “Context” object
$ cat ContextInfo.java
import com.amazonaws.services.lambda.runtime.Context;
public class ContextInfo {
public Context details(Object input, Context context) {
System.out.println("Memory limit in MBs: " + context.getMemoryLimitInMB());
System.out.println("Function name: " + context.getFunctionName());
System.out.println("AWS Request ID: " + context.getAwsRequestId());
System.out.println("Log Stream Name: " + context.getLogStreamName());
System.out.println("Log Group Name: " + context.getLogGroupName());
System.out.println("Client Context: " + context.getClientContext());
System.out.println("Identity: " + context.getIdentity());
System.out.println("Remaining time (in milli seconds): "+
context.getRemainingTimeInMillis());
return context;
}
}
Compiling and running the lambda
$ cat lamdafy.sh
#!/bin/bash
set -x #echo on
rm logresult.txt
rm outputfile.txt
javac -cp ./lib/aws-lambda-java-core-1.0.0.jar:./lib/aws-lambda-java-events-1.0.0.jar ContextInfo.java
zip -r ContextInfo.zip lib/aws-lambda-java-core-1.0.0.jar lib/aws-lambda-java-events-1.0.0.jar ContextInfo.class
aws s3 cp ContextInfo.zip s3://myplasticbucketforlambda
aws lambda update-function-code --function-name ContextInfoLambda --s3-bucket myplasticbucketforlambda --s3-key
ContextInfo.zip
aws lambda invoke --invocation-type RequestResponse --function-name ContextInfoLambda --region us-east-1 --log-type
Tail --payload file://inputfile.txt outputfile.txt >> logresult.txt
jq -r .LogResult logresult.txt | base64 --decode
cat outputfile.txt
echo ""
jq . outputfile.txt
Understanding the “Context” object
Memory limit in MBs: 128
Function name: ContextInfoLambda
AWS Request ID: 32320904-5805-11e7-8904-ebe1abfa66b8
Log Stream Name: 2017/06/23/[$LATEST]acf60f48492b4df59ef8ebe534fffe00
Log Group Name: /aws/lambda/ContextInfoLambda
Client Context: null
Identity: lambdainternal.api.LambdaCognitoIdentity@589838eb
Remaining time (in milli seconds): 2778
Understanding the “Context” object
getFunctionName()
Name of the lambda function being executed (e.g.,
FirstJavaLambda)
getFunctionVersion() Version of the function (or its alias if it points to an alias)
getInvokedFunctionArn()
Get the ARN (Amazon Resource Name), for example,
arn:aws:lambda:us-west-2:431635030606:function:HelloWorld
getLogStreamName() Returns the CloudWatch log stream name
getLogger() Returns the logger associated with the given context object
getMemoryLimitInMB()
Amount of memory set as limit when creating the lambda
function (value returned in MBs)
getRemainingTimeInMillis()
Returns the amount of time remaining for execution (based on the
time limit set during creating the function)
Watching CloudWatch logs
To watch with CloudWatch, create a new role with following accesses:
	 arn:aws:iam::aws:policy/AWSLambdaExecute
	 arn:aws:iam::aws:policy/AWSLambdaFullAccess
Streams stdout and stderr are redirected to
CloudWatch logs; can be viewed from AWS console
Using the /tmp directory
❖ Applications can use “/tmp” directory
❖ If the underlying container gets recycled, the files in the
“/tmp” directory will be gone!
❖ Also, /tmp is limited to 500 MB size - that is a limiting
factor for many kinds of applications.
❖ For example, if we want to convert a video from one
format to another, then this limit matters.
Dealing with code dependencies
❖ External libraries and dependencies must be bundled with the
lambda function as zip files (or jar files depending on the context)
❖ There is limitation to the size of the dependencies that we can
upload, currently it is 30MB.
❖ That is quite small for real-world requirement where the
dependent libraries can be large.
❖ A workaround for this limitation is to upload it into S3 bucket,
put it in to /tmp directory for the lambda and then use it.
Using lambdas with AWS services
❖ For real-world uses, its practically not feasible to use lambda without
the AWS eco-system:
❖ S3 can be used for processing images, converting document formats,
etc from the lambdas. Large dependencies for the lambda can be
stored in S3 and processed from the lambdas
❖ SNS (Simple Notification Service) can be used for event processing
❖ DynamoDB can be used for persistence and data processing
❖ Alexa can be used for automated voice responses with Amazon Echo
for example
❖ Lex can be used for chatbots with lambda as the back-end code
How does a lambda terminate?
❖ How does a lambda terminate?
(A) Timeout - once the given maximum duration is
reached, the function will terminate
(B) Normal termination - returning from the lambda -
when the function returns, the lambda terminates
(C)Abnormal termination - forcefully terminating the
lambda with calling functions (e.g. process.exit() in
nodejs)
Lambda resource limits
Source: http://docs.aws.amazon.com/lambda/latest/dg/limits.html
Lambda deployment size limits
Source: http://docs.aws.amazon.com/lambda/latest/dg/limits.html
AWS Serverless Stack
❖ API Gateway
❖ Lambda
❖ Greengrass
❖ Step Functions
❖ SQS
❖ DynamoDB
❖ …
Costing aspects
❖ There are two factors for pricing calculation
1. Request costs: refers to number of executions - it is
calculated at 100ms slices
2. Execution costs: these are variable costs; change the memory
size and the execution cost will be calculated accordingly
❖ There is no cost for idle time
❖ You can use the online pricing calculator to estimate how much it
may cost you: https://s3.amazonaws.com/lambda-tools/
pricing-calculator.html
Pricing calculation example
Pricing calculation example
Costing aspects
❖ In AWS lambda, the increase in the memory is associated
with increased CPU and network I/O speeds.
❖ In free tier, it makes sense to increase it to the max MBs.
❖ Note that the cost is not based on actual consumption,
but on the max. cap.
❖ Lots of calls execute only for short duration, like 30 ms.
However billing is done for 100ms minimum. Hence, one
way is to design applications that make fewer but longer
calls.
Serverless != Always Lower Costs!
❖ It is a myth that adopting serverless will always reduce
your costs. It is NOT true. The key in cost savings is in
how you utilise serverless. For example, serverless is
suitable if you have spiky workloads (or idle scenarios).
It is NOT suitable in scenarios where your demand is
stable.
How does AWS Lambda work?
Internally, it uses containers!
❖ Internally, AWS Lambda uses Linux Containers
❖ When a lambda function is invoked, it launches a
container (with the provided config settings)
❖ When a function is called for the first time (or after it is
updated), spawning the container adds some latency
❖ Container is terminated and is “frozen” for reuse
❖ If called again “soon”, it is “thawed” and invoked
again
Based on: http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html
Freeze/Thaw cycle
freeze/thaw cycle - how the execution gets frozen up and is warmed up again
Freeze/Thaw cycle
freeze/thaw cycle - how the execution gets frozen up and is warmed up again
Execution
Terminate
Freeze
Thaw
Cold start
How AWS Lambda works
❖ Handlers are executed on workers. Time for starting-up of
a worker is around 1 to 2 seconds.
❖ In case of a “load burst”, the Lambda load balancer sends
them to new workers - that will incur latencies.
❖ For a container to execute the handler immediately, it must
be in running state.
❖ However, if handlers are called only once in a while,
then the container goes to paused or stopped state and it
takes time to get back to running state again.
Cold vs. warm invocation
❖ Cold invocation - requires warm-up time (e.g., when
starting for the first time) - the latency may be
perceivable to the users
❖ Actions like code redeployment or making
configuration changes can force redeployment of the
lambda that make it cold invocation
❖ Warm invocation - lambda already deployed and ready
to serve as soon as it is triggered or called
How to keep your container “warm”?
❖ You can use a “warming trigger” to
ensure that the lambda function
doesn’t go cold. Trigger it within
every few minutes.
❖ Schedule CloudWatch events to
fire every few minutes to keep the
container “warm”
❖ In serverless framework, there is a
plugin that keeps the lambda
warm by sending an event every
5 minutes or so: https://
github.com/FidelLimited/
serverless-plugin-warmup
Best Practice
Don’t depend on container reuse, but make best use of it
Example #1: copy files from s3 and use it from /tmp, but check if the files
in /tmp exist before trying to access them!
Example #2: Instantiate AWS client, establish database connects, etc outside
the handler - they will not be initialised again if container is reused
How about other languages?
❖ Lambda currently supports limited set of languages
(JavaScript - with Node.js, Python, Java and C#)
❖ What if you want to use some other language, say Go?
❖ You can still run Go by following a few steps:
❖ http://blog.0x82.com/2014/11/24/aws-lambda-
functions-in-go/
❖ https://serifandsemaphore.io/go-amazon-
lambda-7e95a147cec8
Security
❖ IAM (Identity & Access Management) provides the security for your
lambdas
❖ Specific accesses are often required; for example, to watch lambda
logs with CloudWatch, create a new role with following accesses:
❖ arn:aws:iam::aws:policy/AWSLambdaExecute
❖ arn:aws:iam::aws:policy/AWSLambdaFullAccess
❖ Due to security and legal aspects, serverless functions may need to
run privately. In this case, lambda functions can be executed on AWS
VPC (Virtual Private Cloud) inside a private network.
Using “aws iam” - example
$ aws iam list-roles | jq -r .Roles[].Arn
arn:aws:iam::431635030606:role/helloworld-dev
arn:aws:iam::431635030606:role/service-role/javatesting
arn:aws:iam::431635030606:role/LambdaExecuteRole
$ aws iam list-roles | jq -r .Roles[].Arn | grep ExecuteRole
arn:aws:iam::431635030606:role/LambdaExecuteRole
Serverless != Always Lower Costs!
❖ It is a myth that adopting serverless will always reduce
your costs. It is NOT true. The key in cost savings is in
how you utilise serverless. For example, serverless is
suitable if you have spiky workloads (or idle scenarios).
It is NOT suitable in scenarios where your demand is
stable.
Related topics
How to use physical servers?
What’s not suitable
❖ Extremely long running jobs
❖ Jobs that require extensive communication between
each other
❖ Constant loads and well-known costs
❖ Responses with very low-latency
Rearchitecting to serverless functions
❖ Moving to serverless is not as
easy as flipping a switch: for
existing applications, it may
even require re-architecting/re-
writing.
❖ This is because serverless
computation architecture
model is quite different from
the way traditionally
software is written and
deployed.
Costing in Google Cloud Functions
* Includes both Background and HTTP Functions.
Source: https://cloud.google.com/functions/
So, what’s the catch?
❖ Runtime and resource limitations
(memory, dependency sizes)
❖ Vendor lock-in (because non-
trivial lambdas will use services
from providers)
❖ Lambdas are still low-level
“primitives”
❖ Tooling yet to mature (for testing,
deploying, monitoring, …)
❖ …
Serverless looks awesome - let’s explore!
Links for serverless technologies
❖ AWS Lambda: https://aws.amazon.com/lambda/
❖ Azure Functions: https://functions.azure.com/
❖ Google Cloud Functions: https://cloud.google.com/functions/  
❖ Apache OpenWhisk: https://github.com/openwhisk
❖ Serverless framework: https://github.com/serverless/serverless
❖ Fission: https://github.com/fission/fission
❖ Hyper.sh: https://github.com/hyperhq /
❖ Funktion: https://funktion.fabric8.io/
❖ Kubeless: http://kubeless.io/  
Tools to Explore
Tools to simplify using AWS Lambda
❖ Most frameworks available today in serverless domain try to simplify
AWS! Here is a partial list (all of the for AWS):
❖ Chalice (Python)
❖ ClaudiaJS (NodeJS)
❖ Dawson (Node)
❖ Lambada Framework (Java)
❖ Shep (Node)
❖ Sparta (Go)
❖ Zappa (Python)
Node Lambda (for Node.js)
❖ This is a “command line tool to locally run and deploy
your node.js application to Amazon Lambda”
❖ Why? Instead of testing your Lambda in AWS, you can
write it locally and run it and test it; when everything is
good, then deploy it in AWS Lambda
❖ URL: https://github.com/motdotla/node-lambda
❖ “The Standard Library for Functions as a Service.
Discover pre-built APIs, compose your own, build apps,
and move your business faster than ever with new
"server-less" technology.”
❖ Aims to be the “standard library for the web”!
❖ Check out https://stdlib.com/ and https://
github.com/stdlib/lib
Books to Read
Book Recommendations
❖ Has many interesting examples
❖ The supporting website has
demos that you can try out:
https://eventdrivenapps.com/
❖ URL: https://
www.manning.com/books/
aws-lambda-in-action
Book Recommendations
❖ Focus on & examples using AWS
Lambda
❖ Covers serverless patterns and
architectures
❖ Written by Dr. Peter Sbarski, head
of Serverlessconf
❖ Serverless Architectures on AWS,
Peter Sbarski, Manning
Publications, 376 pages, April 2017.
URL: https://www.amazon.com/
Serverless-Architectures-AWS-
examples-Lambda/dp/1617293822
Book Recommendations
❖ Serverless: Patterns of Modern
Application Design Using
Microservices (Amazon Web
Services Edition), Obie
Fernandez, LeanPub, 2016.
https://leanpub.com/
serverless
Book Recommendations
❖ Comprehensive - free - guide
on AWS Lambda is available
here: http://
docs.aws.amazon.com/
lambda/latest/dg/lambda-
dg.pdf
Links
❖ M. Fowler’s early article on serverless http://
martinfowler.com/articles/serverless.html
❖ AWS Lambda local runner: https://github.com/
cagataygurturk/aws-lambda-local-runner
❖ Java on AWS Lambda: https://www.infoq.com/news/
2017/06/fearless-aws-lambda
❖ The twelve-factor app: https://12factor.net/
Video Resources
❖ Serverless Architectures: What, why, why not, and
where next? - Mike Roberts
❖ Serverless: the Future of Software Architecture - Peter
Sbarski
❖ Serverless computing options with Google Cloud
Platform - Bret McGowen
Serverless Summit
India’s first conference on
serverless technologies!
Image Credits
❖ http://www.nag.co.za/wp-content/uploads/2013/04/Stone-Age-PC.jpg
❖ http://cdn2.hubspot.net/hub/148740/file-1853309085-jpg/RAM_-_stoneage.jpg
❖ https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/WernerVogels.JPG/220px-WernerVogels.JPG
❖ https://image.slidesharecdn.com/devopssummit-openkeynote-noops-141105113330-conversion-gate01/95/noops-no-
operations-2-638.jpg?cb=1420567266
❖ http://f4.bcbits.com/img/a2377654591_10.jpg
❖ https://cdn.meme.am/cache/instances/folder981/500x/75497981/roll-safee-servers-cant-crash-if-there-are-no-servers.jpg
❖ https://www.commitstrip.com/wp-content/uploads/2017/04/Strip-Severless-650-finalenglishV2.jpg
❖ https://www.trovaweb.net/images/pizzeria-tavola-calda-barbecue-self-service-free-e-mangia-palermo/pizzeria-tavola-calda-barbecue-
self-service-free-e-mangia-palermo-11.JPG
❖ http://2ndwatch.com/wp-content/uploads/2016/05/AWS-Lambda.png
❖ http://wendyonline.nl/wp-content/uploads/2015/11/eekhoorn-nootjes-1024x656.jpg
❖ https://innovationcentre.com.au/wp-content/uploads/2017/03/michievent.jpg
❖ http://orig00.deviantart.net/da2f/f/2013/034/f/4/alonzo_and_lambda_by_kinow-d5tqvau.png
❖ https://travistation.files.wordpress.com/2012/04/david-hasselhoff-as-michael-knight-in-knightrider-thumbs-up-263w_350h.jpg
❖ http://www.otona-beauty.com/wp-content/uploads/2015/08/150803_06.jpg
❖ https://s-media-cache-ak0.pinimg.com/736x/d7/7c/f7/d77cf70f4e8b56a834b9f8475c7ba5e2.jpg
Image Credits
❖ https://www.incimages.com/uploaded_files/image/970x450/getty_dv778060_45540.jpg
❖ https://s3.amazonaws.com/s3.timetoast.com/public/uploads/photos/8221934/download_%285.jpg?
1478393447
❖ http://cliparts.co/cliparts/ATb/rkr/ATbrkrMXc.jpg
❖ http://bloggingwizard.adamconnell1.netdna-cdn.com/wp-content/uploads/2015/07/How-To-Grow-Your-
Blogs-Audience-S.png
❖ http://www.esosolutions.com/images/home_analytics.svg
❖ https://images-na.ssl-images-amazon.com/images/I/51SPHnoK%2BrL.jpg
❖ http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Here%E2%80%99s-How-You-Can-
Combat-The-Exhaustion-You-Feel-All-The-Time-4.png
❖ http://awscomputeblogmedia.s3.amazonaws.com/
zombie_high_level_architecture_of_survivor_serverless_chat_app.png
❖ https://s-media-cache-ak0.pinimg.com/236x/99/00/51/990051c22c8abba5fbd6dc21786e91f3--fire-and-ice-
crps.jpg
❖ http://pngimg.com/uploads/snake/snake_PNG4075.png
reachus@codeops.tech
www.codeops.tech
@CodeOpsTech
+91 98801 64463

More Related Content

What's hot

AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
Scott Leberknight
 
Intro to AWS Lambda
Intro to AWS Lambda Intro to AWS Lambda
Intro to AWS Lambda
Amazon Web Services
 
AWS 101
AWS 101AWS 101
Serverless Architectures.pdf
Serverless Architectures.pdfServerless Architectures.pdf
Serverless Architectures.pdf
Amazon Web Services
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
Muhammed YALÇIN
 
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
Amazon Web Services
 
Serverless Computing
Serverless Computing Serverless Computing
Serverless Computing
Rushi Namani
 
Getting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and ServerlessGetting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and Serverless
Amazon Web Services
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
Amazon Web Services
 
Aws
AwsAws
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
Amazon Web Services
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
Nikolaus Graf
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
Amazon Web Services
 
AWS Lambda Features and Uses
AWS Lambda Features and UsesAWS Lambda Features and Uses
AWS Lambda Features and Uses
GlobalLogic Ukraine
 
Introduction to AWS Services and Cloud Computing
Introduction to AWS Services and Cloud ComputingIntroduction to AWS Services and Cloud Computing
Introduction to AWS Services and Cloud Computing
Amazon Web Services
 
Serverless Microservices Communication with Amazon EventBridge
Serverless Microservices Communication with Amazon EventBridgeServerless Microservices Communication with Amazon EventBridge
Serverless Microservices Communication with Amazon EventBridge
SheenBrisals
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
Andrew Dixon
 
AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...
AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...
AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...
Edureka!
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Amazon Web Services
 
Introduction to AWS Cloud Computing
Introduction to AWS Cloud ComputingIntroduction to AWS Cloud Computing
Introduction to AWS Cloud Computing
Amazon Web Services
 

What's hot (20)

AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Intro to AWS Lambda
Intro to AWS Lambda Intro to AWS Lambda
Intro to AWS Lambda
 
AWS 101
AWS 101AWS 101
AWS 101
 
Serverless Architectures.pdf
Serverless Architectures.pdfServerless Architectures.pdf
Serverless Architectures.pdf
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
 
Serverless Computing
Serverless Computing Serverless Computing
Serverless Computing
 
Getting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and ServerlessGetting Started with AWS Lambda and Serverless
Getting Started with AWS Lambda and Serverless
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
 
Aws
AwsAws
Aws
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
 
AWS Lambda Features and Uses
AWS Lambda Features and UsesAWS Lambda Features and Uses
AWS Lambda Features and Uses
 
Introduction to AWS Services and Cloud Computing
Introduction to AWS Services and Cloud ComputingIntroduction to AWS Services and Cloud Computing
Introduction to AWS Services and Cloud Computing
 
Serverless Microservices Communication with Amazon EventBridge
Serverless Microservices Communication with Amazon EventBridgeServerless Microservices Communication with Amazon EventBridge
Serverless Microservices Communication with Amazon EventBridge
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...
AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...
AWS Tutorial | AWS Certified Solutions Architect | Amazon AWS | AWS Training ...
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
Introduction to AWS Cloud Computing
Introduction to AWS Cloud ComputingIntroduction to AWS Cloud Computing
Introduction to AWS Cloud Computing
 

Similar to Serverless Architecture - A Gentle Overview

What's New in AWS Serverless and Containers
What's New in AWS Serverless and ContainersWhat's New in AWS Serverless and Containers
What's New in AWS Serverless and Containers
Amazon Web Services
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
Amazon Web Services
 
Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...
Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...
Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...
Amazon Web Services
 
Serverless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemServerless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat System
Amazon Web Services
 
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Paweł Pikuła
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
Amazon Web Services
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
Amazon Web Services
 
Aws Lambda in Swift - NSLondon - 3rd December 2020
Aws Lambda in Swift - NSLondon - 3rd December 2020Aws Lambda in Swift - NSLondon - 3rd December 2020
Aws Lambda in Swift - NSLondon - 3rd December 2020
Andrea Scuderi
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
Amazon Web Services
 
Serverless computing
Serverless computingServerless computing
Serverless computing
Dmitriy Ivanov
 
Building Serverless APIs (January 2017)
Building Serverless APIs (January 2017)Building Serverless APIs (January 2017)
Building Serverless APIs (January 2017)
Julien SIMON
 
Migrating your .NET Applications to the AWS Serverless Platform
Migrating your .NET Applications to the AWS Serverless PlatformMigrating your .NET Applications to the AWS Serverless Platform
Migrating your .NET Applications to the AWS Serverless Platform
Amazon Web Services
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS Lambda
Amazon Web Services
 
Apache OpenWhisk
Apache OpenWhiskApache OpenWhisk
Apache OpenWhisk
Simon Sasaki
 
An introduction to serverless architectures (February 2017)
An introduction to serverless architectures (February 2017)An introduction to serverless architectures (February 2017)
An introduction to serverless architectures (February 2017)
Julien SIMON
 
Čtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal HatákČtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal Haták
Ctvrtkoncz
 
Getting Started with Serverless PHP
Getting Started with Serverless PHPGetting Started with Serverless PHP
Getting Started with Serverless PHP
Andrew Raines
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
Amazon Web Services
 
(CMP403) AWS Lambda: Simplifying Big Data Workloads
(CMP403) AWS Lambda: Simplifying Big Data Workloads(CMP403) AWS Lambda: Simplifying Big Data Workloads
(CMP403) AWS Lambda: Simplifying Big Data Workloads
Amazon Web Services
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
Thomas Chacko
 

Similar to Serverless Architecture - A Gentle Overview (20)

What's New in AWS Serverless and Containers
What's New in AWS Serverless and ContainersWhat's New in AWS Serverless and Containers
What's New in AWS Serverless and Containers
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
 
Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...
Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...
Serverless for Developers: Event-Driven & Distributed Apps - Pop-up Loft TLV ...
 
Serverless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat SystemServerless by Example: Building a Real-Time Chat System
Serverless by Example: Building a Real-Time Chat System
 
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Aws Lambda in Swift - NSLondon - 3rd December 2020
Aws Lambda in Swift - NSLondon - 3rd December 2020Aws Lambda in Swift - NSLondon - 3rd December 2020
Aws Lambda in Swift - NSLondon - 3rd December 2020
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Serverless computing
Serverless computingServerless computing
Serverless computing
 
Building Serverless APIs (January 2017)
Building Serverless APIs (January 2017)Building Serverless APIs (January 2017)
Building Serverless APIs (January 2017)
 
Migrating your .NET Applications to the AWS Serverless Platform
Migrating your .NET Applications to the AWS Serverless PlatformMigrating your .NET Applications to the AWS Serverless Platform
Migrating your .NET Applications to the AWS Serverless Platform
 
A Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS LambdaA Walk in the Cloud with AWS Lambda
A Walk in the Cloud with AWS Lambda
 
Apache OpenWhisk
Apache OpenWhiskApache OpenWhisk
Apache OpenWhisk
 
An introduction to serverless architectures (February 2017)
An introduction to serverless architectures (February 2017)An introduction to serverless architectures (February 2017)
An introduction to serverless architectures (February 2017)
 
Čtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal HatákČtvrtkon #64 - AWS Serverless - Michal Haták
Čtvrtkon #64 - AWS Serverless - Michal Haták
 
Getting Started with Serverless PHP
Getting Started with Serverless PHPGetting Started with Serverless PHP
Getting Started with Serverless PHP
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
(CMP403) AWS Lambda: Simplifying Big Data Workloads
(CMP403) AWS Lambda: Simplifying Big Data Workloads(CMP403) AWS Lambda: Simplifying Big Data Workloads
(CMP403) AWS Lambda: Simplifying Big Data Workloads
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
 

More from CodeOps Technologies LLP

AWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetupAWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetup
CodeOps Technologies LLP
 
Understanding azure batch service
Understanding azure batch serviceUnderstanding azure batch service
Understanding azure batch service
CodeOps Technologies LLP
 
DEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNINGDEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNING
CodeOps Technologies LLP
 
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONSSERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
CodeOps Technologies LLP
 
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONSBUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
CodeOps Technologies LLP
 
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICESAPPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
CodeOps Technologies LLP
 
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPSBUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
CodeOps Technologies LLP
 
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNERCREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CodeOps Technologies LLP
 
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CodeOps Technologies LLP
 
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESSWRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
CodeOps Technologies LLP
 
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh SharmaTraining And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
CodeOps Technologies LLP
 
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaDeploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
CodeOps Technologies LLP
 
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
CodeOps Technologies LLP
 
YAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra KhareYAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra Khare
CodeOps Technologies LLP
 
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
CodeOps Technologies LLP
 
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaMonitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
CodeOps Technologies LLP
 
Jet brains space intro presentation
Jet brains space intro presentationJet brains space intro presentation
Jet brains space intro presentation
CodeOps Technologies LLP
 
Functional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and StreamsFunctional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and Streams
CodeOps Technologies LLP
 
Distributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps FoundationDistributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps Foundation
CodeOps Technologies LLP
 
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire  "Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
CodeOps Technologies LLP
 

More from CodeOps Technologies LLP (20)

AWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetupAWS Serverless Event-driven Architecture - in lastminute.com meetup
AWS Serverless Event-driven Architecture - in lastminute.com meetup
 
Understanding azure batch service
Understanding azure batch serviceUnderstanding azure batch service
Understanding azure batch service
 
DEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNINGDEVOPS AND MACHINE LEARNING
DEVOPS AND MACHINE LEARNING
 
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONSSERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
 
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONSBUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
 
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICESAPPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
 
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPSBUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
 
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNERCREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
 
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
 
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESSWRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
 
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh SharmaTraining And Serving ML Model Using Kubeflow by Jayesh Sharma
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
 
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaDeploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
 
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
 
YAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra KhareYAML Tips For Kubernetes by Neependra Khare
YAML Tips For Kubernetes by Neependra Khare
 
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
 
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaMonitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
 
Jet brains space intro presentation
Jet brains space intro presentationJet brains space intro presentation
Jet brains space intro presentation
 
Functional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and StreamsFunctional Programming in Java 8 - Lambdas and Streams
Functional Programming in Java 8 - Lambdas and Streams
 
Distributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps FoundationDistributed Tracing: New DevOps Foundation
Distributed Tracing: New DevOps Foundation
 
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire  "Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
 

Recently uploaded

OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 

Recently uploaded (20)

OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 

Serverless Architecture - A Gentle Overview

  • 1. Serverless Architecture: Overview Ganesh Samarthyam ganesh@codeops.tech Organizer: India Serverless Summit www.inserverless.com
  • 2. Are you dealing with web-servers, app- servers, session and entity beans, …: in short, are you a stone-age programmer?
  • 3. Greek characters are scary! The term “lambda” originates from the “lambda calculus” (yes, yes, that same scary math stuff!)
  • 4. He he, but lambdas are fun, not scary
  • 5. def main(args): name = args.get("name", "stranger") greeting = "Hello " + name + "!" print(greeting) return {"greeting": greeting} Lambda functions! import com.amazonaws.services.lambda.runtime.Context; public class helloworld { public String handleRequest(String name, Context context) { String greetings = "Hello " + name; context.getLogger().log("Name: " + name); System.out.println(greetings); return greetings; } } function main() { return {payload: 'Hello world'}; } Python Java JavaScript (Node.JS)
  • 7. Lambdas is just a fancy name for stateless functions without side- effects!
  • 8. Evolution: Servers to serverless Code Runtime OS Hardware Code Runtime OS Hardware Code Runtime OS Hardware Code Runtime OS Hardware Physical Servers Virtual Machines Containers Serverless
  • 9. Evolution: Servers to serverless Slow-iteration and deployment Faster-iteration and deployment Fastest-iteration and deployment Rapid iteration and deployment Single tenency Multi-tenency Super multi- tenancy Extreme multi- tenancy Unfriendly for polyglots Somewhat friendly for polyglots Friendly for polyglots Very friendly for polyglots Deploy in weeks Deploy in minutes Deploy in seconds Deploy independently Typically alive for years Typically alive for weeks Typically alive for hours Typically alive for seconds Physical Servers Virtual Machines Containers Serverless Source: https://www.slideshare.net/AmazonWebServices/getting-started-with-serverless-architectures-63429092
  • 11. What is serverless? “Serverless architectures refer to applications that significantly depend on third-party services (knows as Backend as a Service or "BaaS") or on custom code that's run in ephemeral containers (Function as a Service or “FaaS”)” - Martin Fowler
  • 12.
  • 13. – Serverless for Dummies “Serverless: just put your code in cloud and run it”
  • 14. What is serverless? ❖ Serverless is often referred to as FaaS - Function as a Service. Gartner refers to it as fPaaS - function Platform as a Service. ❖ The model in serverless architecture is this: a distributed system that reacts to events or process workloads dynamically based on demand by spinning up ephemeral (short-lived) containers or computational resources in the cloud.
  • 16. On the term “lambda”
  • 17. On the term “lambda” ❖ The term “lambda” originates from the “lambda calculus”. In 1936, Alonzo Church developed a logic system that was later adopted for computation. ❖ Most languages (including Java, C# and C++) support lambda functions today. ❖ In languages supporting lambda functions, it is an unnamed function that takes input coming variables and returns a value. ❖ A salient characteristic of lambda functions is the lack of side-effects.
  • 18. Look ma, no servers!
  • 19. Unix pipes - 1973!
  • 20. – Doug McIlroy “Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.”
  • 21.
  • 22.
  • 23. But, but, “Serverless != No servers” Lambdas are executed in servers in cloud - so we still have servers! What serverless means is you don't have to care about servers: no provisioning, maintenance, etc.
  • 24. Why serverless? – Google Cloud Functions https://cloud.google.com/functions/ “Serve users from zero to planet-scale, all without managing any infrastructure.”
  • 25. – Gartner "By 2022, most platform as a service (PaaS) offerings will evolve to a fundamentally serverless model, rendering the cloud platform architectures dominating in 2017 as legacy architectures" 
  • 29. Serverless - characteristics granular payment event-driven self-managed scale on demand
  • 34. Serverless - some use cases mobile back-ends Real-time analytics data processing static-websites live-video stream processing chatbots
  • 39. Live video-steam processing source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-serverless-architectures-cmp211
  • 40. Use case #1: web applications source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
  • 41. Use case #2: batch processing source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
  • 42. Use case #3: stream processing source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
  • 43. Lambda architecture style source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-serverless-architectural-patterns-and-best-practices-arc402
  • 44. Towards LessOps model? Serverless frameworks move us towards LessOps model - meaning no or few operators are required for monitoring and maintaining the servers and infrastructure.
  • 45. – Dr Werner Vogels (Amazon CTO) "What we’ve seen is a revolution where complete applications are being stripped of all their servers, and only code is being run. Quite a few companies are ripping out big pieces of their applications and replacing their servers, their VMs and their containers with just code… Perhaps we no longer have to think about servers!”
  • 46. Popular technologies AWS Lambda Google Cloud Functions IBM/Adobe/ Apache OpenWhisk Azure Functions
  • 47. Five principles for serverless applications Use a compute service to execute code on demand (no servers) Write single-purpose stateless functions Design push-based, event-driven pipelines Create thicker, more powerful front ends Embrace third-party services Source: Peter Sbarski, “Serverless Architectures on AWS”, Manning, 2017
  • 50. AWS Lambda ❖ Lambda is one of the earliest technologies for serverless (13 Nov 2014). It is also the most mature and stable platform. ❖ http://aws.amazon.com/lambda ❖ Currently supported (as on June 2017) - .NET Core 1.01. (C#), Java 8, Node.js 4.3, Node.js 6.10.2, Python 2.7 and 3.6.
  • 51. Three ways to create a function ❖ There are three ways to create the same lambda function: ❖ AWS Lambda console (web UI) ❖ AWS CLI (from your commandline) ❖ AWS SDK
  • 52. Execution Environment ❖ Public Amazon Linux AMI version (AMI name: amzn-ami- hvm-2016.03.3.x86_64-gp2) ❖ Linux kernel version – 4.4.51-40.60.amzn1.x86_64 ❖ When creating native (64-bit) binaries for executing in Lambda, this information is important - so that code can be compiled to this target ❖ The following libraries are available in execution environment ❖ AWS SDK – AWS SDK for JavaScript version 2.45.0 ❖ AWS SDK for Python (Boto 3) version 1.4.4, Botocore version 1.5.43 ❖ Amazon Linux build of java-1.8.0-openjdk for Java Source: http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
  • 53. A simple lambda $ cat hello.py def lambda_handler(event, context): print "hello srushit" return 'Hello from srushit' $ zip -r hello-world hello.py $ aws lambda create-function --region us-east-1 --function-name FirstPythonLambda --zip-file fileb:///Users/gsamarthyam/hello-world.zip -- role arn:aws:iam::431635030606:role/LambdaExecuteRole --runtime python2.7 --handler hello::lambda_handler Notes: (a) Once you upload the function from command-line, it takes time to see the updated source code from the AWS console online. (b) In Python, print statements and Logger functions in the logging module are logged - you can check them in CloudWatch logs.
  • 54. A hello world lambda in Java $ cat Hello.java import com.amazonaws.services.lambda.runtime.Context; public class Hello { public String handleRequest(String name, Context context) { return "Hello " + name; } } http://docs.aws.amazon.com/lambda/latest/dg/java-programming-model.html
  • 55. A simple lambda hello::handleRequest Input string “Ganesh” Context object Result string “Hello Ganesh” AWS Lambda Execution on a Linux container
  • 56. Step #1 $ javac -cp ./lib/aws-lambda-java-core-1.0.0.jar:./lib/aws-lambda-java-events-1.0.0.jar Hello.java $ Need to provide the dependencies (Context class in this case) to compile it; dependency details available from: https://github.com/ aws/aws-lambda-java-libs (“Official mirror for interface definitions and helper classes for Java code running on the AWS Lambda platform.”)
  • 57. Step #2 $ zip -r Hello.zip Hello.class lib/aws-lambda-java-core-1.0.0.jar lib/aws-lambda-java- events-1.0.0.jar adding: Hello.class (deflated 35%) adding: lib/aws-lambda-java-core-1.0.0.jar (deflated 39%) adding: lib/aws-lambda-java-events-1.0.0.jar (deflated 27%) $ ls -lh Hello.zip -rw-r--r-- 1 gsamarthyam staff 14K Jun 19 15:01 Hello.zip $ ls -lh lib -rw-r--r-- 1 gsamarthyam staff 29K Jun 23 16:12 aws-lambda-java-core-1.0.0.jar -rw-r--r--@ 1 gsamarthyam staff 11K Jun 18 16:44 aws-lambda-java-events-1.0.0.jar Create a zip file with the dependencies - in this case, it is just a couple of standard dependencies
  • 58. Step #3 $ aws lambda create-function --region us-east-1 --function-name FirstJavaLambda --zip-file fileb:///Users/ gsamarthyam/serverless/Hello.zip --role arn:aws:iam::431635030606:role/LambdaExecuteRole --handler Hello::handleRequest --runtime java8 { "TracingConfig": { "Mode": "PassThrough" }, "CodeSha256": "DpRB5zFF1ORVw6tTSIMprA1BgGNmpf+oGBFBy8/APWo=", "FunctionName": "FirstJavaLambda", "CodeSize": 13988, "MemorySize": 128, "FunctionArn": "arn:aws:lambda:us-east-1:431635030606:function:FirstJavaLambda", "Version": "$LATEST", "Role": "arn:aws:iam::431635030606:role/LambdaExecuteRole", "Timeout": 3, "LastModified": "2017-06-23T10:50:02.582+0000", "Handler": "Hello::handleRequest", "Runtime": "java8", "Description": "" }
  • 59. Step #4 $ aws lambda invoke --invocation-type RequestResponse --function-name FirstJavaLambda --region us-west-2 --log-type Tail --payload '"Ganesh"' outputfile.txt { "LogResult": "U1RBUlQgUmVxdWVzdElkOiBmYzM2N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZmY gVmVyc2lvbjogJExBVEVTVApsb2cgZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29udGl udWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnIgCiB0aGlzIGlzIGNvbn RpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogdGh pcyBpcyBjb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IGZjMzY3YjY 0LTU4MDEtMTFlNy1iOWU5LTk5NDM2ZTg4MTJmZgpSRVBPUlQgUmVxdWVzdElkOiBmYzM2 N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZmYJRHVyYXRpb246IDI2MC45MyBtcwlC aWxsZWQgRHVyYXRpb246IDMwMCBtcyAJTWVtb3J5IFNpemU6IDEyOCBNQglNYXggTWVtb3 J5IFVzZWQ6IDQwIE1CCQo=", "StatusCode": 200 } $ cat outputfile.txt "Hello Ganesh. log stream = 2017/06/23/[$LATEST]680db95163b346579ce89f51535db346"
  • 60. Step #4 $ echo "U1RBUlQgUmVxdWVzdElkOiBmYzM2N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZm YgVmVyc2lvbjogJExBVEVTVApsb2cgZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29ud GludWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnIgCiB0aGlzIGlzIGNv bnRpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogd GhpcyBpcyBjb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IGZjMzY3Y jY0LTU4MDEtMTFlNy1iOWU5LTk5NDM2ZTg4MTJmZgpSRVBPUlQgUmVxdWVzdElkOiBmY zM2N2I2NC01ODAxLTExZTctYjllOS05OTQzNmU4ODEyZmYJRHVyYXRpb246IDI2MC45MyBt cwlCaWxsZWQgRHVyYXRpb246IDMwMCBtcyAJTWVtb3J5IFNpemU6IDEyOCBNQglNYXggT WVtb3J5IFVzZWQ6IDQwIE1CCQo=" | base64 --decode START RequestId: fc367b64-5801-11e7-b9e9-99436e8812ff Version: $LATEST log data from stdout this is continuation of system.out log data from stderr this is continuation of system.err log data from LambdaLogger this is continuation of logger.logEND RequestId: fc367b64-5801-11e7-b9e9-99436e8812ff REPORT RequestId: fc367b64-5801-11e7-b9e9-99436e8812ff Duration: 260.93 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 40 MB
  • 61. Step #4 $ aws lambda get-function --function-name FirstJavaLambda { "Code": { "RepositoryType": "S3", "Location": "https://prod-04-2014-tasks.s3.amazonaws.com/snapshots/431635030606/FirstJavaLambda-961856c8-8808-4d77-aa26- bde4c62745d9?X-Amz-Security- Token=FQoDYXdzENP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDJIA1ZghlrarR%2FS8sCK3A9ic4dl6r2QeYmybaLJ%2FR4VxX3e%2BN8413pI vMLfpND96fpnK5g55zaaI4nQkYcW70zwZu9mZ3%2FXrQqObP1PKpY1BBr0uP7BrDn8wF062XuBQG4AMaoxBQ44cSvUC8cr%2FGVU2MpAzFEK0 0kgOtI9fax%2FB6eAt5xzKN2Zt4SpCtFktfaNTq15Vxm2RIk8s30Yw53jte7fPPtaUZPJZT4%2F872zNrylxSfKAfRdOvrv4%2FvGur21evlliheJ0mriQZ NBcRkRsNWIC6MkG48inkiRL4AjWN9BNWXl5JhpPxgHfZTEnb2st1SJuuJdx3SyWs2u8Wh8J%2BV90eyuZSqDeXXRQCmk4QNhSalvLboN6M9oTC VBh7uMdsLDkxje3FOlRdDYMJW9kcyMc%2BcqUOeeeO46m7ky0t%2BKtvDrY887jjziG3PTQjZrFPwmiEHgVImzhfa9RN8eAXb3xcnPqC97rzOM1GZ kAD%2BuJbECu%2B1t7H93rhG5ObQZVBT4llxBq%2BQXpI0FHjqpVE7wOs7hEuqws65gXxVOltBVHv7TwsTIxibH88uai%2BpyRV%2BC6NUK%2FpL QZDF8wCqozh%2B%2FHvmAo2smzygU%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20170623T110025Z&X-Amz- SignedHeaders=host&X-Amz-Expires=600&X-Amz-Credential=ASIAIHFSB5YQLFLCC34Q%2F20170623%2Fus-east-1%2Fs3%2Faws4_request&X- Amz-Signature=af988a347e62ebf6fe89d3593b68ada63be6bcd74f6b12222b96b762c7204924" }, "Configuration": { "TracingConfig": { "Mode": "PassThrough" }, "Version": "$LATEST", "CodeSha256": "DpRB5zFF1ORVw6tTSIMprA1BgGNmpf+oGBFBy8/APWo=", "FunctionName": "FirstJavaLambda", "MemorySize": 128, "CodeSize": 13988, "FunctionArn": "arn:aws:lambda:us-east-1:431635030606:function:FirstJavaLambda", "Handler": "Hello::handleRequest", "Role": "arn:aws:iam::431635030606:role/LambdaExecuteRole", "Timeout": 3, "LastModified": "2017-06-23T10:50:02.582+0000", "Runtime": "java8", "Description": "" } }
  • 62. How to update the function? $ aws lambda update-function-code --function-name arn:aws:lambda:us- east-1:431635030606:function:FirstJavaLambda --zip-file fileb://Hello.zip { "TracingConfig": { "Mode": "PassThrough" }, "CodeSha256": "DpRB5zFF1ORVw6tTSIMprA1BgGNmpf+oGBFBy8/APWo=", "FunctionName": "FirstJavaLambda", "CodeSize": 13988, "MemorySize": 128, "FunctionArn": "arn:aws:lambda:us-east-1:431635030606:function:FirstJavaLambda", "Version": "$LATEST", "Role": "arn:aws:iam::431635030606:role/LambdaExecuteRole", "Timeout": 3, "LastModified": "2017-06-23T13:34:05.408+0000", "Handler": "Hello::handleRequest", "Runtime": "java8", "Description": "" }
  • 63. How to delete the function? $ aws lambda delete-function --function-name FirstJavaLambda $ aws lambda list-functions | grep FirstJavaLambda $ You can check that once the lambda is deleted, the list-functions doesn’t list it anymore
  • 64. Available commands in “aws lambda” • add-permission • create-alias • create-event-source-mapping • create-function • delete-alias • delete-event-source-mapping • delete-function • get-account-settings • get-alias • get-event-source-mapping • get-function • get-function-configuration • get-policy • help • invoke • invoke-async • list-aliases • list-event-source-mappings • list-functions • list-tags • list-versions-by-function • publish-version • remove-permission • tag-resource • untag-resource • update-alias • update-event-source-mapping • update-function-code • update-function-configuration
  • 65. Using AWS SDK to create lambdas $ cat testing.py def lambda_handler(event, context): return 'Hello from Lambda' $ cat invokelambda.py import boto3 import json client = boto3.client('lambda') response = client.invoke( FunctionName='arn:aws:lambda:us-east-1:431635030606:function:testing', InvocationType='RequestResponse', LogType='Tail', Payload=json.dumps({}) ) result = response['Payload'].read() print(result) $ python invokelambda.py "Hello from Lambda" $
  • 66. Kinds of lambda invocations • Event based lambdas are invoked based on triggers; example: when a file is dropped in a S3 bucket, a lambda may be invoked • Async in nature • No response sent back to the invoker Event RequestResponse • Synchronous - when invoked, it executes and waits till completion and returns something to the invoker • Happens when invoked through API gateway, CLI or AWS console
  • 67. Specifying invocation types in CLI Help description for —invocation-type option for “aws lambda invoke” from AWS CLI
  • 68. Using base64 ❖ Sometimes it is convenient to use base64 whenever you want to send data to the lambda or return from the lambda, or get that data again as context. this avoids adding unicode characters etc. ❖ Logs in lambdas often use base64. You can use the “base64 --decode” command (mac/linux) to read the log file
  • 69. Using base64 - example $ cat logresult.txt { "LogResult": "U1RBUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMgVmVyc2lvbjogJExBVEVTVApsb2c gZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29udGludWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnI gCiB0aGlzIGlzIGNvbnRpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogdGhpcyBpcyB jb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IDJkZGYyNDc2LTU4MTctMTFlNy1hYjhhLTZkZDBlYzFhMWV iYwpSRVBPUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMJRHVyYXRpb246IDUuMDIgbXM JQmlsbGVkIER1cmF0aW9uOiAxMDAgbXMgCU1lbW9yeSBTaXplOiAxMjggTUIJTWF4IE1lbW9yeSBVc2VkOiA0NiBNQgkK", "StatusCode": 200 } $ echo "U1RBUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMgVmVyc2lvbjogJExBVEVTVApsb2c gZGF0YSBmcm9tIHN0ZG91dCAKIHRoaXMgaXMgY29udGludWF0aW9uIG9mIHN5c3RlbS5vdXQKbG9nIGRhdGEgZnJvbSBzdGRlcnI gCiB0aGlzIGlzIGNvbnRpbnVhdGlvbiBvZiBzeXN0ZW0uZXJyCmxvZyBkYXRhIGZyb20gTGFtYmRhTG9nZ2VyIAogdGhpcyBpcyB jb250aW51YXRpb24gb2YgbG9nZ2VyLmxvZ0VORCBSZXF1ZXN0SWQ6IDJkZGYyNDc2LTU4MTctMTFlNy1hYjhhLTZkZDBlYzFhMWV iYwpSRVBPUlQgUmVxdWVzdElkOiAyZGRmMjQ3Ni01ODE3LTExZTctYWI4YS02ZGQwZWMxYTFlYmMJRHVyYXRpb246IDUuMDIgbXM JQmlsbGVkIER1cmF0aW9uOiAxMDAgbXMgCU1lbW9yeSBTaXplOiAxMjggTUIJTWF4IE1lbW9yeSBVc2VkOiA0NiBNQgkK" | base64 --decode START RequestId: 2ddf2476-5817-11e7-ab8a-6dd0ec1a1ebc Version: $LATEST log data from stdout this is continuation of system.out log data from stderr this is continuation of system.err log data from LambdaLogger this is continuation of logger.logEND RequestId: 2ddf2476-5817-11e7-ab8a-6dd0ec1a1ebc REPORT RequestId: 2ddf2476-5817-11e7-ab8a-6dd0ec1a1ebcDuration: 5.02 msBilled Duration: 100 ms Memory Size: 128 MB Max Memory Used: 46 MB $
  • 70. Understanding the “Context” object $ cat ContextInfo.java import com.amazonaws.services.lambda.runtime.Context; public class ContextInfo { public Context details(Object input, Context context) { System.out.println("Memory limit in MBs: " + context.getMemoryLimitInMB()); System.out.println("Function name: " + context.getFunctionName()); System.out.println("AWS Request ID: " + context.getAwsRequestId()); System.out.println("Log Stream Name: " + context.getLogStreamName()); System.out.println("Log Group Name: " + context.getLogGroupName()); System.out.println("Client Context: " + context.getClientContext()); System.out.println("Identity: " + context.getIdentity()); System.out.println("Remaining time (in milli seconds): "+ context.getRemainingTimeInMillis()); return context; } }
  • 71. Compiling and running the lambda $ cat lamdafy.sh #!/bin/bash set -x #echo on rm logresult.txt rm outputfile.txt javac -cp ./lib/aws-lambda-java-core-1.0.0.jar:./lib/aws-lambda-java-events-1.0.0.jar ContextInfo.java zip -r ContextInfo.zip lib/aws-lambda-java-core-1.0.0.jar lib/aws-lambda-java-events-1.0.0.jar ContextInfo.class aws s3 cp ContextInfo.zip s3://myplasticbucketforlambda aws lambda update-function-code --function-name ContextInfoLambda --s3-bucket myplasticbucketforlambda --s3-key ContextInfo.zip aws lambda invoke --invocation-type RequestResponse --function-name ContextInfoLambda --region us-east-1 --log-type Tail --payload file://inputfile.txt outputfile.txt >> logresult.txt jq -r .LogResult logresult.txt | base64 --decode cat outputfile.txt echo "" jq . outputfile.txt
  • 72. Understanding the “Context” object Memory limit in MBs: 128 Function name: ContextInfoLambda AWS Request ID: 32320904-5805-11e7-8904-ebe1abfa66b8 Log Stream Name: 2017/06/23/[$LATEST]acf60f48492b4df59ef8ebe534fffe00 Log Group Name: /aws/lambda/ContextInfoLambda Client Context: null Identity: lambdainternal.api.LambdaCognitoIdentity@589838eb Remaining time (in milli seconds): 2778
  • 73. Understanding the “Context” object getFunctionName() Name of the lambda function being executed (e.g., FirstJavaLambda) getFunctionVersion() Version of the function (or its alias if it points to an alias) getInvokedFunctionArn() Get the ARN (Amazon Resource Name), for example, arn:aws:lambda:us-west-2:431635030606:function:HelloWorld getLogStreamName() Returns the CloudWatch log stream name getLogger() Returns the logger associated with the given context object getMemoryLimitInMB() Amount of memory set as limit when creating the lambda function (value returned in MBs) getRemainingTimeInMillis() Returns the amount of time remaining for execution (based on the time limit set during creating the function)
  • 74. Watching CloudWatch logs To watch with CloudWatch, create a new role with following accesses: arn:aws:iam::aws:policy/AWSLambdaExecute arn:aws:iam::aws:policy/AWSLambdaFullAccess Streams stdout and stderr are redirected to CloudWatch logs; can be viewed from AWS console
  • 75. Using the /tmp directory ❖ Applications can use “/tmp” directory ❖ If the underlying container gets recycled, the files in the “/tmp” directory will be gone! ❖ Also, /tmp is limited to 500 MB size - that is a limiting factor for many kinds of applications. ❖ For example, if we want to convert a video from one format to another, then this limit matters.
  • 76. Dealing with code dependencies ❖ External libraries and dependencies must be bundled with the lambda function as zip files (or jar files depending on the context) ❖ There is limitation to the size of the dependencies that we can upload, currently it is 30MB. ❖ That is quite small for real-world requirement where the dependent libraries can be large. ❖ A workaround for this limitation is to upload it into S3 bucket, put it in to /tmp directory for the lambda and then use it.
  • 77. Using lambdas with AWS services ❖ For real-world uses, its practically not feasible to use lambda without the AWS eco-system: ❖ S3 can be used for processing images, converting document formats, etc from the lambdas. Large dependencies for the lambda can be stored in S3 and processed from the lambdas ❖ SNS (Simple Notification Service) can be used for event processing ❖ DynamoDB can be used for persistence and data processing ❖ Alexa can be used for automated voice responses with Amazon Echo for example ❖ Lex can be used for chatbots with lambda as the back-end code
  • 78. How does a lambda terminate? ❖ How does a lambda terminate? (A) Timeout - once the given maximum duration is reached, the function will terminate (B) Normal termination - returning from the lambda - when the function returns, the lambda terminates (C)Abnormal termination - forcefully terminating the lambda with calling functions (e.g. process.exit() in nodejs)
  • 79. Lambda resource limits Source: http://docs.aws.amazon.com/lambda/latest/dg/limits.html
  • 80. Lambda deployment size limits Source: http://docs.aws.amazon.com/lambda/latest/dg/limits.html
  • 81. AWS Serverless Stack ❖ API Gateway ❖ Lambda ❖ Greengrass ❖ Step Functions ❖ SQS ❖ DynamoDB ❖ …
  • 82. Costing aspects ❖ There are two factors for pricing calculation 1. Request costs: refers to number of executions - it is calculated at 100ms slices 2. Execution costs: these are variable costs; change the memory size and the execution cost will be calculated accordingly ❖ There is no cost for idle time ❖ You can use the online pricing calculator to estimate how much it may cost you: https://s3.amazonaws.com/lambda-tools/ pricing-calculator.html
  • 85. Costing aspects ❖ In AWS lambda, the increase in the memory is associated with increased CPU and network I/O speeds. ❖ In free tier, it makes sense to increase it to the max MBs. ❖ Note that the cost is not based on actual consumption, but on the max. cap. ❖ Lots of calls execute only for short duration, like 30 ms. However billing is done for 100ms minimum. Hence, one way is to design applications that make fewer but longer calls.
  • 86. Serverless != Always Lower Costs! ❖ It is a myth that adopting serverless will always reduce your costs. It is NOT true. The key in cost savings is in how you utilise serverless. For example, serverless is suitable if you have spiky workloads (or idle scenarios). It is NOT suitable in scenarios where your demand is stable.
  • 87. How does AWS Lambda work?
  • 88. Internally, it uses containers! ❖ Internally, AWS Lambda uses Linux Containers ❖ When a lambda function is invoked, it launches a container (with the provided config settings) ❖ When a function is called for the first time (or after it is updated), spawning the container adds some latency ❖ Container is terminated and is “frozen” for reuse ❖ If called again “soon”, it is “thawed” and invoked again Based on: http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html
  • 89. Freeze/Thaw cycle freeze/thaw cycle - how the execution gets frozen up and is warmed up again
  • 90. Freeze/Thaw cycle freeze/thaw cycle - how the execution gets frozen up and is warmed up again Execution Terminate Freeze Thaw Cold start
  • 91. How AWS Lambda works ❖ Handlers are executed on workers. Time for starting-up of a worker is around 1 to 2 seconds. ❖ In case of a “load burst”, the Lambda load balancer sends them to new workers - that will incur latencies. ❖ For a container to execute the handler immediately, it must be in running state. ❖ However, if handlers are called only once in a while, then the container goes to paused or stopped state and it takes time to get back to running state again.
  • 92. Cold vs. warm invocation ❖ Cold invocation - requires warm-up time (e.g., when starting for the first time) - the latency may be perceivable to the users ❖ Actions like code redeployment or making configuration changes can force redeployment of the lambda that make it cold invocation ❖ Warm invocation - lambda already deployed and ready to serve as soon as it is triggered or called
  • 93. How to keep your container “warm”? ❖ You can use a “warming trigger” to ensure that the lambda function doesn’t go cold. Trigger it within every few minutes. ❖ Schedule CloudWatch events to fire every few minutes to keep the container “warm” ❖ In serverless framework, there is a plugin that keeps the lambda warm by sending an event every 5 minutes or so: https:// github.com/FidelLimited/ serverless-plugin-warmup
  • 94. Best Practice Don’t depend on container reuse, but make best use of it Example #1: copy files from s3 and use it from /tmp, but check if the files in /tmp exist before trying to access them! Example #2: Instantiate AWS client, establish database connects, etc outside the handler - they will not be initialised again if container is reused
  • 95. How about other languages? ❖ Lambda currently supports limited set of languages (JavaScript - with Node.js, Python, Java and C#) ❖ What if you want to use some other language, say Go? ❖ You can still run Go by following a few steps: ❖ http://blog.0x82.com/2014/11/24/aws-lambda- functions-in-go/ ❖ https://serifandsemaphore.io/go-amazon- lambda-7e95a147cec8
  • 96. Security ❖ IAM (Identity & Access Management) provides the security for your lambdas ❖ Specific accesses are often required; for example, to watch lambda logs with CloudWatch, create a new role with following accesses: ❖ arn:aws:iam::aws:policy/AWSLambdaExecute ❖ arn:aws:iam::aws:policy/AWSLambdaFullAccess ❖ Due to security and legal aspects, serverless functions may need to run privately. In this case, lambda functions can be executed on AWS VPC (Virtual Private Cloud) inside a private network.
  • 97. Using “aws iam” - example $ aws iam list-roles | jq -r .Roles[].Arn arn:aws:iam::431635030606:role/helloworld-dev arn:aws:iam::431635030606:role/service-role/javatesting arn:aws:iam::431635030606:role/LambdaExecuteRole $ aws iam list-roles | jq -r .Roles[].Arn | grep ExecuteRole arn:aws:iam::431635030606:role/LambdaExecuteRole
  • 98. Serverless != Always Lower Costs! ❖ It is a myth that adopting serverless will always reduce your costs. It is NOT true. The key in cost savings is in how you utilise serverless. For example, serverless is suitable if you have spiky workloads (or idle scenarios). It is NOT suitable in scenarios where your demand is stable.
  • 100. How to use physical servers?
  • 101. What’s not suitable ❖ Extremely long running jobs ❖ Jobs that require extensive communication between each other ❖ Constant loads and well-known costs ❖ Responses with very low-latency
  • 102. Rearchitecting to serverless functions ❖ Moving to serverless is not as easy as flipping a switch: for existing applications, it may even require re-architecting/re- writing. ❖ This is because serverless computation architecture model is quite different from the way traditionally software is written and deployed.
  • 103. Costing in Google Cloud Functions * Includes both Background and HTTP Functions. Source: https://cloud.google.com/functions/
  • 104. So, what’s the catch? ❖ Runtime and resource limitations (memory, dependency sizes) ❖ Vendor lock-in (because non- trivial lambdas will use services from providers) ❖ Lambdas are still low-level “primitives” ❖ Tooling yet to mature (for testing, deploying, monitoring, …) ❖ …
  • 105. Serverless looks awesome - let’s explore!
  • 106. Links for serverless technologies ❖ AWS Lambda: https://aws.amazon.com/lambda/ ❖ Azure Functions: https://functions.azure.com/ ❖ Google Cloud Functions: https://cloud.google.com/functions/   ❖ Apache OpenWhisk: https://github.com/openwhisk ❖ Serverless framework: https://github.com/serverless/serverless ❖ Fission: https://github.com/fission/fission ❖ Hyper.sh: https://github.com/hyperhq / ❖ Funktion: https://funktion.fabric8.io/ ❖ Kubeless: http://kubeless.io/  
  • 108. Tools to simplify using AWS Lambda ❖ Most frameworks available today in serverless domain try to simplify AWS! Here is a partial list (all of the for AWS): ❖ Chalice (Python) ❖ ClaudiaJS (NodeJS) ❖ Dawson (Node) ❖ Lambada Framework (Java) ❖ Shep (Node) ❖ Sparta (Go) ❖ Zappa (Python)
  • 109. Node Lambda (for Node.js) ❖ This is a “command line tool to locally run and deploy your node.js application to Amazon Lambda” ❖ Why? Instead of testing your Lambda in AWS, you can write it locally and run it and test it; when everything is good, then deploy it in AWS Lambda ❖ URL: https://github.com/motdotla/node-lambda
  • 110. ❖ “The Standard Library for Functions as a Service. Discover pre-built APIs, compose your own, build apps, and move your business faster than ever with new "server-less" technology.” ❖ Aims to be the “standard library for the web”! ❖ Check out https://stdlib.com/ and https:// github.com/stdlib/lib
  • 112. Book Recommendations ❖ Has many interesting examples ❖ The supporting website has demos that you can try out: https://eventdrivenapps.com/ ❖ URL: https:// www.manning.com/books/ aws-lambda-in-action
  • 113. Book Recommendations ❖ Focus on & examples using AWS Lambda ❖ Covers serverless patterns and architectures ❖ Written by Dr. Peter Sbarski, head of Serverlessconf ❖ Serverless Architectures on AWS, Peter Sbarski, Manning Publications, 376 pages, April 2017. URL: https://www.amazon.com/ Serverless-Architectures-AWS- examples-Lambda/dp/1617293822
  • 114. Book Recommendations ❖ Serverless: Patterns of Modern Application Design Using Microservices (Amazon Web Services Edition), Obie Fernandez, LeanPub, 2016. https://leanpub.com/ serverless
  • 115. Book Recommendations ❖ Comprehensive - free - guide on AWS Lambda is available here: http:// docs.aws.amazon.com/ lambda/latest/dg/lambda- dg.pdf
  • 116. Links ❖ M. Fowler’s early article on serverless http:// martinfowler.com/articles/serverless.html ❖ AWS Lambda local runner: https://github.com/ cagataygurturk/aws-lambda-local-runner ❖ Java on AWS Lambda: https://www.infoq.com/news/ 2017/06/fearless-aws-lambda ❖ The twelve-factor app: https://12factor.net/
  • 117. Video Resources ❖ Serverless Architectures: What, why, why not, and where next? - Mike Roberts ❖ Serverless: the Future of Software Architecture - Peter Sbarski ❖ Serverless computing options with Google Cloud Platform - Bret McGowen
  • 118. Serverless Summit India’s first conference on serverless technologies!
  • 119. Image Credits ❖ http://www.nag.co.za/wp-content/uploads/2013/04/Stone-Age-PC.jpg ❖ http://cdn2.hubspot.net/hub/148740/file-1853309085-jpg/RAM_-_stoneage.jpg ❖ https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/WernerVogels.JPG/220px-WernerVogels.JPG ❖ https://image.slidesharecdn.com/devopssummit-openkeynote-noops-141105113330-conversion-gate01/95/noops-no- operations-2-638.jpg?cb=1420567266 ❖ http://f4.bcbits.com/img/a2377654591_10.jpg ❖ https://cdn.meme.am/cache/instances/folder981/500x/75497981/roll-safee-servers-cant-crash-if-there-are-no-servers.jpg ❖ https://www.commitstrip.com/wp-content/uploads/2017/04/Strip-Severless-650-finalenglishV2.jpg ❖ https://www.trovaweb.net/images/pizzeria-tavola-calda-barbecue-self-service-free-e-mangia-palermo/pizzeria-tavola-calda-barbecue- self-service-free-e-mangia-palermo-11.JPG ❖ http://2ndwatch.com/wp-content/uploads/2016/05/AWS-Lambda.png ❖ http://wendyonline.nl/wp-content/uploads/2015/11/eekhoorn-nootjes-1024x656.jpg ❖ https://innovationcentre.com.au/wp-content/uploads/2017/03/michievent.jpg ❖ http://orig00.deviantart.net/da2f/f/2013/034/f/4/alonzo_and_lambda_by_kinow-d5tqvau.png ❖ https://travistation.files.wordpress.com/2012/04/david-hasselhoff-as-michael-knight-in-knightrider-thumbs-up-263w_350h.jpg ❖ http://www.otona-beauty.com/wp-content/uploads/2015/08/150803_06.jpg ❖ https://s-media-cache-ak0.pinimg.com/736x/d7/7c/f7/d77cf70f4e8b56a834b9f8475c7ba5e2.jpg
  • 120. Image Credits ❖ https://www.incimages.com/uploaded_files/image/970x450/getty_dv778060_45540.jpg ❖ https://s3.amazonaws.com/s3.timetoast.com/public/uploads/photos/8221934/download_%285.jpg? 1478393447 ❖ http://cliparts.co/cliparts/ATb/rkr/ATbrkrMXc.jpg ❖ http://bloggingwizard.adamconnell1.netdna-cdn.com/wp-content/uploads/2015/07/How-To-Grow-Your- Blogs-Audience-S.png ❖ http://www.esosolutions.com/images/home_analytics.svg ❖ https://images-na.ssl-images-amazon.com/images/I/51SPHnoK%2BrL.jpg ❖ http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Here%E2%80%99s-How-You-Can- Combat-The-Exhaustion-You-Feel-All-The-Time-4.png ❖ http://awscomputeblogmedia.s3.amazonaws.com/ zombie_high_level_architecture_of_survivor_serverless_chat_app.png ❖ https://s-media-cache-ak0.pinimg.com/236x/99/00/51/990051c22c8abba5fbd6dc21786e91f3--fire-and-ice- crps.jpg ❖ http://pngimg.com/uploads/snake/snake_PNG4075.png