SSH into Containers

This guide has steps to SSH into running containers like Flightcontrol Web and Worker service types.

We have a Flightcontrol CLI planned that will make this process much easier.

AWS CLI Setup

  1. Download and install the AWS CLI from https://aws.amazon.com/cli/.
  2. Download and install the Session Manager Plugin.
  3. Configure AWS CLI access, by adding user credentials.

SSH into a container

  1. Get the region of your service from the Flightcontrol dashboard
  2. Get the cluster ID of your service from the Flightcontrol dashboard:
    1. Navigate to the service’s AWS Resources tab in the Service Sidebar
    2. Find the “ECS Service” resource card
    3. Copy the short ID from the “ECS Service” card. Example: rails-app-z880xp2 (Contact support if you need the ID for preview environments)
  3. Run this command, to list the servers running in your cluster:
    aws ecs list-tasks --region <region> --cluster <cluster-id>
  4. Copy a task ID from the list. The task ID is the last piece for the ARN, like this
    arn:aws:ecs:us-east-2:xxxxxx:task/<cluster-name>/<task id>
  5. Run this command which will get you shell access:
    aws ecs execute-command --region <region> --cluster <cluster-id> --container <cluster-id> --task <task-id> --interactive --command "/bin/sh"
  6. Repeat steps 3 - 5 every time you want shell access.