windowsamazon-ec2console-applicationnancyaws-code-deploy

Executing a console app through AWS CodeDeploy doesn't work, but manually running the batchfile does?


I have a Nancyfx console application, which I'm trying to deploy to an AWS EC2 Windows instance using AWS CodeDeploy. All steps show a successful run in CodeDeploy's Deployment dashboard, though the application is not actually starting correctly.

The problem is isolated to the ApplicationStart hook, which is a one line batch file that runs the application's exe. If I RDP into the instance and run the batch file manually, it operates as expected.

Expected Result: - The application's console window opens - Debug printouts indicate pulling some initial data from DynamoDB was successful - Debug printout indicates the application is running. - Console window is held open by waiting for any input (Nancyfx's default setup)

Actual Result: - No console window opens, but CodeDeploy's logs show the stdout for the following - Debug printouts indicate pulling the initial data failed - Debug printout indicates the application is running - Application is not running

I guess the problem lies with how CodeDeploy is executing the batchfile, but I couldn't find answers for such a specific and hard-to-Google problem. Please help!


Solution

  • Solved - I discovered that DynamoDB calls within the application were causing it to exit prematurely, which was resolved by giving the IAM role DynamoDB access.