4

I am trying to publish a .NET core 3.1 project from VS2019 into AWS Elastic Beanstalk. Once I fill all the information necessary for deployment and hit deploy, I get the following error on the output.

Unknown error executing command: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Amazon.Common.DotNetCli.Tools.RoleHelper.ExpandInstanceProfile(IAmazonIdentityManagementService iamClient, String instanceProfile)
   at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.GetInstanceProfileOrDefault(String propertyValue, CommandOption option, Boolean required, String newRoleName)
   at Amazon.ElasticBeanstalk.Tools.Commands.DeployEnvironmentCommand.<CreateEnvironment>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Amazon.ElasticBeanstalk.Tools.Commands.DeployEnvironmentCommand.<PerformActionAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.<ExecuteAsync>d__10.MoveNext()

Anyone else having trouble with this?

shawn_w8
  • 33
  • 5

2 Answers2

9

You will have created an account which has the policy AWSElasticBeanstalkFullAccess. This account also needs to be allowed IAM:GetInstanceProfile permission.

As a quick test add the 'IAMFullAccess' policy to that account then try deploying. That should work. This violates the principle of least privilege though and isn't recommended on a production system - where you should enable only specific permissions.

DaWaugh
  • 91
  • 2
0

At the "Options" stage of the AWS toolkit deployment it selects "Debug|Any CPU" by default. I was doing a deploy with my release build so I had to select "Release|Any CPU"

This resolved the same error for me in VS 2019

Maarten
  • 402
  • 5
  • 20