AWS Tools for Microsoft Visual Studio Team Services
User Guide

AWS Lambda .NET Core Deployment Task


Builds, packages and deploys a .NET Core AWS Lambda function or serverless application. Optionally the task can create the deployment package for subsequent deployment in another build or release pipeline.

Note: this task is specific to Lambda functions written in C# or F#. For other languages supportedby Lambda please refer to the AWS Lambda Deploy Function task.


Applications based on Lambda (also referred to as serverless applications) are composed of functions triggered by events. A typical serverless application consists of one or more functions triggered by events such as object uploads to Amazon S3, Amazon SNS notifications, and API actions. Those functions can stand alone or use other resources such as Amazon DynamoDB tables or Amazon S3 buckets. The most basic serverless application is simply a function.


You can set the following parameters for the task. Required parameters are noted by an asterisk (*). Other parameters are optional.

Display name*

The default name of the task instance, which can be modified: Deploy .NET Core to Lambda

AWS Credentials

Specifies the AWS credentials to be used by the task in the build agent environment.

You can specify credentials using a service endpoint (of type AWS) in the task configuration or you can leave unspecified. If unspecified the task will attempt to obtain credentials from the following sources in order:

  • From task variables named AWS.AccessKeyID, AWS.SecretAccessKey and optionally AWS.SessionToken.

  • From credentials set in environment variables in the build agent process. When using environment variables in the build agent process you may use the standard AWS environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and optionally AWS_SESSION_TOKEN.

  • If the build agent is running on an Amazon EC2 instance, from the instance metadata associated with the EC2 instance. For credentials to be available from EC2 instance metadata the instance must have been started with an instance profile referencing a role granting permissions to the task to make calls to AWS on your behalf. See IAMRolesForEC2 for more information.

AWS Region

The AWS region code (us-east-1, us-west-2 etc) of the region containing the AWS resource(s) the task will use or create. For more information, see Regions and Endpoints in the Amazon Web Services General Reference.

If a region is not specified in the task configuration the task will attempt to obtain the region to be used using the standard AWS environment variable AWS_REGION in the build agent process's environment. Tasks running in build agents hosted on Amazon EC2 instances (Windows or Linux) will also attempt to obtain the region using the instance metadata associated with the EC2 instance if no region is configured on the task or set in the environment variable.

Note: The regions listed in the picker are those known at the time this software was released. New regions that are not listed may still be used by entering the region code of the region (for example us_west_2).

Deployment Type*

The type of deployment to perform, or package to build or deploy.

  • Function deploys a single function to Lambda, or creates a package zip file for subsequent deployment.

  • Serverless Application performs a deployment using AWS CloudFormation (allowing multiple functions to be deployed at the same time) or builds the application and uploads it to Amazon S3, outputting the serverless template file for subsequent deployment of the updated code using .

Note: both options will perform the relevant NuGet package restore and build operations to create the resulting deployment package.

Create deployment package only

If selected the task creates the outputs for the selected deployment type but does not perform the deployment to AWS lambda or AWS CloudFormation.

Package-only output file

Available when Create deployment package only is selected.

When Deployment Type is set to Function specifies the output folder and filename of the packaged zip file. This zip file can then be used with the AWS Lambda Deploy Function task to perform the deployment at a later stage.

When Deployment Type is set to Serverless Application specifies the output folder and filename where the serverless template file, updated to contain the Amazon S3 location of the built project code and artifacts, will be placed. This updated template can then be used with the AWS CloudFormation Create/Update Stack task, or AWS CloudFormation change set tasks, to perform the deployment at a later stage.

Path to Lambda Project*

The relative path to the location of the function or serverless application project to package and/or deploy.

Function Deployment: Lambda Function Properties

Function Name

The name of the Lambda function to invoke. You can also specify the Amazon Resource Name (ARN) of the function when deploying to an existing function.

Function Role

The name of the IAM role providing access to AWS services for the deployed Lambda function.

Function Handler

The function within your code that Lambda calls to begin execution. The format is <assembly-name>::<namespace.type-name>::<function-name>.

Function Memory (MB)

The memory allocated to the Lambda function. The value must be in multiples of 64.

Function Timeout (Seconds)

The function execution time at which Lambda should terminate the function.

Serverless Application Deployment: Serverless Application Properties

Stack Name

The name of the AWS CloudFormation stack to deploy to.

Note: This field is required when performing a deployment of a serverless application using this task. When performing a package-only build this field is ignored as the stack name is only relevant during deployment.

S3 Bucket

The name of the Amazon S3 bucket used to store the built project code. This field is required when performing a either a deployment or package-only build of a serverless application.

S3 Prefix

The object key prefix to be used for the packaged objects that will be uploaded to Amazon S3 for subsequent deployment.


Additional Command Line Arguments for Lambda Tools

Additional arguments that can be passed to the dotnet lambda CLI extension command that is used to build, package and deploy your function or serverless application using this task.

Task Permissions

This task requires permissions to call the following AWS service APIs (depending on selected task options, not all APIs may be used):

  • lambda:CreateFunction

  • lamda:UpdateFunctionCode

  • lambda:GetFunctionConfiguration

  • cloudformation:CreateChangeSet

  • cloudformation:ExecuteChangeSet

  • cloudformation:DescribeStackEvents

  • cloudformation:DeleteStack

  • cloudformation:DescribeChangeSet

  • cloudformation:DescribeStacks

  • s3:CreateBucket

  • s3:GetBucketLocation

The task also requires permissions to upload your Lambda function or serverless application content to the specified Amazon S3 bucket. Depending on the size of the application bundle, either putObject or the S3 multi-part upload APIs may be used.