首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Powershell执行.Netcore“发布到AWS .”

问使用Powershell执行.Netcore“发布到AWS .”
EN

Stack Overflow用户
提问于 2019-04-14 09:49:31
回答 1查看 423关注 0票数 0

我使用VisualStudio2017与AWS一起开发了一个.Net核心lambda函数。我在一个名为serverless.template的文件中有Cloudformation,在一个名为aws defaults.json的文件中有一个部署配置。在开发该项目时,我一直使用“发布到AWS Lambda.”将其部署到AWS开发帐户。右击解决方案资源管理器中的选项。

现在我已经准备好将其部署到我们的暂存和生产AWS帐户,并需要执行“发布到AWS Lambda.”使用Cloudformation部署步骤,我们将创建Cloudformation集,以允许在部署之前进行检查。

我一直在试图找出该做什么,并尝试了'aws cloudformation包‘和'sam’CLI命令,但我似乎找不到前进的道路。

有人能帮我理解“发布到AWS Lambda.”的步骤吗?表演?我想在Powershell中重现这些步骤,因为这将为我提供继续前进所需的理解。

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-04-15 15:23:01

若要从命令行部署,请为Lambda使用dotnet CLI扩展。当您从向导发布时,在Visual中运行的代码是相同的,可以读取默认文件等等,因此无论您是从IDE还是从命令行部署,都可以获得一致的部署体验。

您提到您想要了解幕后发生了什么--这些工具是开源的,因此您可以查看它在这个GitHub存储库中为您做的所有工作。在部署无服务器应用程序时,自动使用CloudFormation更改集,您不需要自己处理它。

该工具是一个.NET核心全局工具,首先从命令行安装:

代码语言:javascript
复制
dotnet tool install -g Amazon.Lambda.Tools

一旦安装完毕,您可以获得帮助等:

代码语言:javascript
复制
PS C:\> dotnet lambda help
Amazon Lambda Tools for .NET Core applications (3.2.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet



Commands to deploy and manage AWS Lambda functions:

        deploy-function         Command to deploy the project to AWS Lambda
        invoke-function         Command to invoke a function in Lambda with an optional input
        list-functions          Command to list all your Lambda functions
        delete-function         Command to delete a Lambda function
        get-function-config     Command to get the current runtime configuration for a Lambda function
        update-function-config  Command to update the runtime configuration for a Lambda function

Commands to deploy and manage AWS Serverless applications using AWS CloudFormation:

        deploy-serverless       Command to deploy an AWS Serverless application
        list-serverless         Command to list all your AWS Serverless applications
        delete-serverless       Command to delete an AWS Serverless application

Commands to publish and manage AWS Lambda Layers:

        publish-layer           Command to publish a Layer that can be associated with a Lambda function
        list-layers             Command to list Layers
        list-layer-versions     Command to list versions for a Layer
        get-layer-version       Command to get the details of a Layer version
        delete-layer-version    Command to delete a version of a Layer

Other Commands:

        package                 Command to package a Lambda project into a zip file ready for deployment
        package-ci              Command to use as part of a continuous integration system.

To get help on individual commands execute:
        dotnet lambda help <command>

若要从命令行部署项目,首先将cd放到项目文件夹中,然后执行命令

代码语言:javascript
复制
dotnet lambda deploy-serverless

这将读取默认文件中的设置,并为您执行部署,就像您使用了IDE向导一样。

希望这与开源回购一起帮助您深入了解所涉及的步骤。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55673935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档