发布内置于 .NET Core 的 AWS Lambda 函数时出错 [英] Error in publishing an AWS Lambda function built in .NET Core

查看:13
本文介绍了发布内置于 .NET Core 的 AWS Lambda 函数时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

截至 2016 年 12 月 1 日,AWS Lambda 现在支持在 .NET Core 1.0 运行时中运行的 C# 函数.因此,我使用 VS AWS Lambda 模板创建了该函数.我尝试通过 VS 中的发布到 AWS Lambda..."上下文菜单发布 lambda 函数.因此,在对话框中配置功能(选择 S3 存储桶、区域等)后,单击发布,在发布过程结束时,出现错误:

As of Dec 1, 2016, AWS Lambda now supports functions in C# that runs in the .NET Core 1.0 runtime. So I created the function using the VS AWS Lambda Template. I tried to publish the lambda function via the "Publish to AWS Lambda..." context menu in VS. So after configuring the function(selecting the S3 bucket, region, etc) in the dialog box, I click publish and at the end of the publish process, I am getting error:

Error creating CloudFormation change set: User: arn:aws:iam::***:user/demo_user is not authorized to perform: cloudformation:CreateChangeSet on resource: arn:aws:cloudformation:us-east-1:****:stack/****

我想我可以将策略附加/授予组/用户到 cloudformation,但我只能在选择中看到此策略:AWSCloudFormationReadOnlyAccess

I figured I can just attach/grant a policy to the group/user to cloudformation but I can only see this policy in the selection: AWSCloudFormationReadOnlyAccess

我期待看到某种 ReadWrite 或 FullAccess.

I was expecting to see some kind of ReadWrite or FullAccess.

需要帮助将函数发布到 AWS lambda.谢谢!

Need help publishing the function to AWS lambda. Thanks!

推荐答案

我认为这与要使用的帐户配置文件有关;需要允许此人发布 lambda.

I believe this is related to the account profile to use; this one needs to be allowed to publish the lambda.

在 Visual Studio 中,当您右键单击 AWS Lambda 项目 -> 发布时,您会看到要发布的窗口.顶部是要使用的帐户配置文件和发布到的区域;默认采用您在安装插件时使用的 aws_user 帐户

From within Visual Studio, when you right-click the AWS Lambda project -> Publish, you see the window to publish. At the top is the account profile to use and the Region where to publish to; default takes the aws_user account that you used when you installed the plugin

您可以尝试为您自己的用户提供 AWSLambdaFullAccess 策略,以便能够发布 lambda.您可以在 AWS 的 IAM 控制台中执行此操作.

What you can try is to provide your own user the AWSLambdaFullAccess policy to be able to publish the lambda. You can do this within the IAM console of AWS.

除了使用上下文菜单,您还可以尝试从 dotnet cli 命令行发布.

Instead of using the context menu, you could also try publishing from the dotnet cli command line.

  1. 在控制台中,转到 .net 核心项目所在的文件夹
  2. 在这里您可以使用 dotnet lambda 控制台功能.

这是因为从该文件夹中,dotnet cli 能够找到并使用位于包子文件夹中的 AWS 包/或使用 project.json 来定位这些包.

this is because from this folder, the dotnet cli is able to find and use the AWS packages located in the packages subfolder / or uses project.json to locate those.

示例:

dotnet lambda 包

dotnet lambda package

将构建 &打包要发布的文件.

will build & package the to be published files.

dotnet lambda 部署函数

dotnet lambda deploy-function

将您的 lambda 函数发布到 AWS 云.

will publish your lambda function to AWS Cloud.

这篇关于发布内置于 .NET Core 的 AWS Lambda 函数时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆