Deployment Configuration
Now it's time to deploy your first Lambda function into AWS. The observant amongst you will have noticed within the function code directory there is a file called aws-lambda-tools-defaults.json
. Open that up and let's have a look inside and walk through each property step by step:
Function Handler
By far the most important of the settings in this file. The function handler. This setting is how the Lambda service knows what to invoke. This setting is split into 3 distinct parts:
- MyFirstLambda - The name of your assembly
- MyFirstLambda.Function - The class name, including the entire namespace
- FunctionHandler - The name of the method call. You can see now why banana would have been confusing.
Profile
Specify the profile to use from your AWS credentials file.
Region
Specify the AWS region to deploy into.
Configuration
The configuration to use on dotnet publish
.
Function Architecture
The processor architecture to use on AWS. Choose betweenm x86_64
and arm64
.
Function Runtime
The runtime to use. Given .NET Core 3.1 is on it's way out of support this will likely be dotnet6
for any new development.
Function Memory Size
The amount of memory to allocate to your Lambda function. As we discovered in the introduction, Lambda is charged per ms of execution and that per ms charge changes based on the memory allocated. Choose a value from 128mb to 10gb.
Function Timeout
You can control the timeout of your Lambda function. Choose anything from 1s through to 15 minutes. The choice is yours. Always specify the value in seconds though. Hint, 15 minutes is 900 seconds.
Function Handler
By far the most important of the settings in this file. The function handler. This setting is how the Lambda service knows what to invoke. This setting is split into 3 distinct parts:
- MyFirstLambda - The name of your assembly
- MyFirstLambda.Function - The class name, including the entire namespace
- FunctionHandler - The name of the method call. You can see now why banana would have been confusing.
Profile
Specify the profile to use from your AWS credentials file.
Region
Specify the AWS region to deploy into.
Configuration
The configuration to use on dotnet publish
.
Function Architecture
The processor architecture to use on AWS. Choose betweenm x86_64
and arm64
.
Function Runtime
The runtime to use. Given .NET Core 3.1 is on it's way out of support this will likely be dotnet6
for any new development.
Function Memory Size
The amount of memory to allocate to your Lambda function. As we discovered in the introduction, Lambda is charged per ms of execution and that per ms charge changes based on the memory allocated. Choose a value from 128mb to 10gb.
Function Timeout
You can control the timeout of your Lambda function. Choose anything from 1s through to 15 minutes. The choice is yours. Always specify the value in seconds though. Hint, 15 minutes is 900 seconds.