These are the slides I used at the #amsterdamdotnet meetup on 2017-03-08.
For the matching (very simple) codebases:
https://github.com/PHeonix25/lambda-helloworld &
https://github.com/PHeonix25/lambda-helloworldcaller
About me
Pat Hermens
● Father of two
● Based in Rotterdam
● Lead Developer at Coolblue
● Still have a soft-spot for VB6
https://hermens.com.au/
2
@phermens
Know your costs! 800,000 sec = 9.25 days
https://aws.amazon.com/lambda/pricing/ 49
@phermens
Almost everything is case-sensitive!
50
@phermens
PS> dotnet lambda deploy-function HelloWorld-EUWest
# New Lambda function created
PS> dotnet lambda invoke-function helloworld-euwest -p "Pat"
# Error invoking Lambda function: Function not found:
arn:aws:lambda:eu-west-1:955206359773:function:helloworld-euwest
‘ILambdaContext’ should ALWAYS be last
51
@phermens
public string SayHi(ILambdaContext context, string name = "World")
{
// … do something
}
RESPONSE: (only on invocation, after deployment)
{
"errorType": "LambdaException",
"errorMessage":
"Method 'SayHi' of type 'MyFirstLambdaFunction.HelloWorld' is not supported:
the method has 2 parameters, but the second parameter is not of type
'Amazon.Lambda.Core.ILambdaContext'."
}
Read the FAQ’s!
https://aws.amazon.com/lambda/faqs/ 52
@phermens
Q: How are compute resources assigned to an AWS
Lambda function?
In the AWS Lambda resource model, you choose the amount of memory
you want for your function, and are allocated proportional CPU power and
other resources.
For example, choosing 256MB of memory allocates approximately twice as
much CPU power to your Lambda function as requesting 128MB of memory
and half as much CPU power as choosing 512MB of memory. You can set your
memory in 64MB increments from 128MB to 1.5GB.
Containers can be reused!
https://aws.amazon.com/blogs/compute/container-reuse-in-lambda/ 53
@phermens