Search code examples
powershellamazon-web-servicesamazon-s3amazon-elastic-beanstalkaws-powershell

Getting (more detailed) Elastic Beanstalk deployment logs - .NET/CLI/PowerShell


I'm deploying (a .NET app) to Elastic Beanstalk from scratch using PowerShell. I'm building a PS script because it's going to run on a CI server and I want to fully understand the process.

The documentation doesn't want to make it easy, finding the expected package format seems an impossible task. Amazon want you to use VS and many details are not forthcoming in the documentation.

To test things, I'm able to set up an app, environment, S3 bucket/key with source (a text file so I can force it to fail), and a version. I use this to monitor deployment progress:

Get-EBEvent -EnvironmentName "my-environment" | Format-Table -AutoSize

The results are not super explanatory (newest log entry at the top):

Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].                                                                                                                                                                                                                        cde232fd-e272-11e4-a431-992b5a7c73fe INFO
[Instance: i-1db1e0fb Module: AWSEBAutoScalingGroup ConfigSet: Hook-EnactAppDeploy, Infra-EmbeddedPostBuild, Hook-PostAppDeploy, Hook-PostInit, Infra-WriteVersionOnStartup] Command failed on instance. Return code: 1 Output: null.                                                                                                          ERROR
Deployment Failed: Unexpected Exception                                                                                                                                                                                                                                                                                                        ERROR
Error occurred during build: Command hooks failed                                                                                                                                                                                                                                                                                              ERROR

It fails - fine. But how should I get more detailed logs about the failure? I checked the bucket in S3 that EB created, but it has no logs. I can't find anything in the docs about using either the API, CLI, or PowerShell cmdlets to get logs from an instance.

In short: how do I get more detailed deployment logs via the AWS API? I can find/adapt/create a PowerShell script for it if needed, just need to know the mechanics!

(Edit: from the management console, I can request logs - these are perfect and in the correct format. What is the API I can use to do this?)


Solution

  • Looks like I wanted Request-EBEnvironmentInfo then Get-EBEnvironmentInfo. I have no idea how I didn't find them before.

    http://docs.aws.amazon.com/powershell/latest/reference/items/Request-EBEnvironmentInfo.html

    http://docs.aws.amazon.com/powershell/latest/reference/items/Get-EBEnvironmentInfo.html