aws/session-manager-plugin

Session Manager Plugin built from source code exits unexpectedly

BohdanPetryshyn opened this issue · 2 comments

Summary

When building the session-manager-plugin binary from source code using Docker, the resulting binary exits unexpectedly when used with the AWS-StartPortForwardingSessionToRemoteHost document.

Steps to reproduce

  1. Clone repo (reproduces on 1.2.398.0 and previous versions)
  2. Follow the Working with Docker instructions to build the binary
    1. Run docker build -t session-manager-plugin-image .
    2. Run docker run -it --rm --name session-manager-plugin -v pwd:/session-manager-plugin session-manager-plugin-image make release
  3. Copy the resulting binary (bin/darwing_amd64_plugin/session-manager-plugin for MacOS) to the installation folder (/usr/local/bin/ for MacOS)
  4. Run AWS CLI against the binary:
    aws ssm start-session \
        --target  <your-target-ec2-instance> \
        --document-name AWS-StartPortForwardingSessionToRemoteHost \
        --parameters '{"host":["<your-target-host-name>"],"portNumber":["<your-target-port>"], "localPortNumber":["<your-local-port>"]}'
    
  5. In 2 to 5 minutes, the session will end unexpectedly. (Idle session timeout: 20m, Maximum session duration: 60m are set in the session manager settings in AWS console)

Considerations

The session-manager-plugin binary downloaded from the link provided in the installation manual normally works in the same scenario. Looks like the build process used for the installation packages differs from what's described in the readme. Another piece of evidence for this is that the VERSION file in the repository contains 1.2.0.0 while the downloaded package contains the correct version (1.2.398.0 in my case).

It would be great if properly built binaries were released along with the source code for each release.

Or maybe my way of using the build artifacts is wrong?