Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

aws-extensions-for-dotnet-cli

> 数据库
Open source

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services

393 stars0 likes2 views
WebsiteGitHub

About

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services

AWS Extensions for .NET CLI

This repository contains AWS tool extensions to the .NET CLI. These tool extensions are focused on building .NET Core and ASP.NET Core applications and deploying them to AWS services. Many of these deployment commands are the same commands the AWS Toolkit for Visual Studio uses to perform its deployment features. This allows you to do initial deployment in Visual Studio and then easily transition from Visual Studio to the command line and automate the deployment.

For example with the AWS Lambda .NET CLI tool extension configured you can deploy a Lambda function from the command line in the Lambda function's project root directory.

dotnet lambda deploy-function MyFunction

The extension will prompt you for missing required parameters. To disable the extension from prompting, set the command line switch --disable-interactive to true.

For a history of releases view the release change log

Installing Extensions

As of September 10th, 2018 these extensions have migrated to be .NET Core Global Tools. As part of the migration each of these tools version number was set to 3.0.0.0

To install these tools use the dotnet tool install command.

dotnet tool install -g Amazon.Lambda.Tools

To update to the latest version of one of these tools use the dotnet tool update command.

dotnet tool update -g Amazon.Lambda.Tools

Migrating from DotNetCliToolReference

To migrate an existing project away from the older project tool, you need to edit your project file and remove the DotNetCliToolReference for the tool package. For example, let's look at an existing Lambda project file.

xml

  
    netcoreapp2.1
    true

    
    Lambda
  
  
  
    
    
  

  
    
    
  

To migrate this project, you need to delete the DotNetCliToolReference element, including Amazon.Lambda.Tools. If you don't remove this line, the older project tool version of Amazon.Lambda.Tools will be used instead of an installed Global Tool.

The AWS Toolkit for Visual Studio before .NET Core 2.1 would look for the presence of Amazon.Lambda.Tools in the project file to determine whether to show the Lambda deployment menu item. Because we knew we were going to switch to Global Tools, and the reference to Amazon.Lambda.Tools in the project was going away, we added the AWSProjectType property to the project file. The current version of the AWS Toolkit for Visual Studio now looks for either the presence of Amazon.Lambda.Tools or the AWSProjectType set to Lambda. Make sure when removing the DotNetCliToolReference that your project file has the AWSProjectType property to continue deploying with the AWS Toolkit for Visual Studio.

Supported AWS Services

The following AWS services each have their own .NET CLI tool extension to make it easy to deploy a .NET Core Application to them.

  • Amazon Elastic Container Service
  • AWS Elastic Beanstalk
  • AWS Lambda

Defaults File

Each tool extension supports a defaults JSON file that is used to preset values for all of the command line switches. When a command is executed it will look for values for the command line switches in this file if they are not specified on the command line. The file is a JSON document where each property name matches the full command line switch excluding the -- prefix.

To avoid confusing missing properties from different tool extensions, each tool extension looks for a different named file in the root of the project.

Tool Extension Defaults File Name
Amazon.ECS.Tools aws-ecs-tools-defaults.json
Amazon.ElasticBeanstalk.Tools aws-beanstalk-tools-defaults.json
Amazon.Lambda.Tools aws-lambda-tools-defaults.json

When deploying with the AWS Toolkit for Visual Studio, you can choose to have the deployment wizard save chosen values into the defaults file. This makes it easy to switch to the command line.

For example, the following aws-ecs-tools-defaults.json has values for the AWS region, AWS credential profile and build configuration. If you use it with an ECS command, you will not need to enter those values.

json
{
    "region": "us-west-2",
    "profile": "default",
    "configuration": "Release"
}

Use the --config-file switch to use an alternative file. Set the --persist-config-file switch is set to true to persist all of its settings in the defaults file.

Amazon Elastic Container Service (Amazon.ECS.Tools)


This tool extension takes care of building a Docker image from a .NET application and then deploying the Docker image to Amazon Elastic Container Service (ECS). The application must contain a dockerfile instructing this tool and the Docker CLI which this tool uses to build the Docker image.

You must install Docker before using this extension to deploy your application.

Install

To install the extension run the following command.

dotnet tool install -g Amazon.ECS.Tools

Available Commands

Deploy Service
dotnet ecs deploy-service ...

Deploys the .NET Core application as service on an ECS cluster. Services are for long lived process like web applications. Services have a desired number of tasks that will run the application. If a task instance dies for whatever reason the service will spawn a new task instance. Services can also be associated with an Elastic Load Balancer so that each of the tasks in the services will be registered as targets for the load balancer.

For list of supported options, use dotnet ecs deploy-service --help:

…
Deploy Task
dotnet ecs deploy-task

Deploys the .NET Core application as task on an ECS Cluster. This is good for batch processing and similar jobs where once the process identified in the dockerfile exits the ECS task should end.

For list of supported options, use dotnet ecs deploy-task --help:

…
Deploy Scheduled Task
dotnet ecs deploy-scheduled-task

Creates a new ECS task definition and then configures a Amazon CloudWatch Event rule to run a task using the new task definition and a scheduled interval.

For list of supported options, use dotnet ecs deploy-scheduled-task --help:

…
Push Image
dotnet ecs push-image

Builds the Docker image from the .NET Core application and pushes it to Amazon Elastic Container Registery (ECR). The other ECS deployment tasks first run this command before continuing on with deployment.

For list of supported options, use dotnet ecs push-image --help:

…

AWS Elastic Beanstalk (Amazon.ElasticBeanstalk.Tools)


This tool extension deploys ASP.NET Core applications to AWS Elastic Beanstalk environment.

Install

To install the extension run the following command.

dotnet tool install -g Amazon.ElasticBeanstalk.Tools

Available Commands

Deploy Environment
dotnet eb deploy-environment

Deploys the ASP.NET Core application to a Elastic Beanstalk environment after building and packaging up the application. If the Elastic Beanstalk environment does not exist then the command will create the environment.

For list of supported options, use dotnet eb deploy-environment --help:

…
Delete Environment
dotnet eb delete-environment

Deletes an environment.

For list of supported options, use dotnet eb delete-environment --help:

…
List Environments
dotnet eb list-environments

Lists all of the current running environments along with the URL to access the environment.

For list of supported options, use dotnet eb list-environments --help:

…

AWS Lambda (Amazon.Lambda.Tools)


This tool extension deploys AWS Lambda .NET Core functions.

Install

To install the extension run the following command.

dotnet tool install -g Amazon.Lambda.Tools

Available Commands

Deploy Function
dotnet lambda deploy-function

Deploys the .NET Core Lambda project directly to the AWS Lambda service. The function is created if this is the first deployment. If the Lambda function already exists then the function code is updated. If any of the function configuration properties specified on the command line are different, the existing function configuration is updated. To avoid accidental function configuration changes during a redeployment, only default values explicitly set on the command line are used. The defaults file is not used.

For list of supported options, use dotnet lambda deploy-function --help:

…
Invoke Function
dotnet lambda invoke-function MyFunction --payload "The Function Payload"

Invokes the Lambda function in AWS Lambda passing in the value of --payload as the input parameter to the Lambda function.

For list of supported options, use dotnet lambda invoke-function --help:

…

When --invoke-mode is set to Stream the function is invoked with InvokeWithResponseStream and the response payload is streamed to the console as it is produced. When set to Event the function is invoked asynchronously and any function error and the durable execution ARN are displayed.

When --invoke-mode is set to DurableExecution the function is assumed to be configured for durable execution. The function is invoked asynchronously, the durable execution ARN is read from the response, and the execution is monitored by polling the GetDurableExecution and GetDurableExecutionHistory APIs, writing progress to the console until the execution reaches a terminal state. For each history event any associated details (such as step inputs, results and errors) are written to the console; large string payload fields are truncated to the first 1000 characters with a note that the payload was truncated. If the supplied function name is not an ARN the latest published version is resolved and its ARN is used for the invocation (the resolved ARN is written to the console); if the function has no published versions an error is reported.

List Functions
dotnet lambda list-functions

List all of the currently deployed Lambda functions.

For list of supported options, use dotnet lambda list-functions --help:

…
Delete Function
dotnet lambda delete-function

Delete a Lambda function

For list of supported options, use dotnet lambda delete-function --help:

…
Get Function Configuration
dotnet lambda get-function-config

Get the Lambda function's configuration like memory limit and timeout.

For list of supported options, use dotnet lambda get-function-config --help:

…
Update Function Configuration
dotnet lambda update-function-config

Update the Lambda function's configuration without uploading new code.

For list of supported options, use dotnet lambda update-function-config --help:

…
Deploy Serverless
dotnet lambda deploy-serverless

Deploys one or more Lambda functions from the Lambda project through CloudFormation. The project uses the serverless.template CloudFormation template to deploy the serverless app along with any additional AWS resources defined in the serverless.template.

CloudFormation stacks created with this command are tagged with the AWSServerlessAppNETCore tag.

For list of supported options, use dotnet lambda deploy-serverless --help:

…
L

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#aws-ecsaws-elastic-beanstalkaws-lambda

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库