> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fly.io/llms.txt
> Use this file to discover all available pages before exploring further.

# IEx into Your Running App

Elixir supports getting a IEx shell into a running production node. How cool is that?

## SSH Into our App

To do this, we will [login with SSH](/flyctl/cmd/fly_ssh) to our
application VM. There is a one-time setup task for using SSH. Follow the instructions.

```
fly ssh issue --agent
```

With SSH configured, let's open a console.

<CodeGroup>
  ```bash cmd theme={null}
  fly ssh console --pty -C "/app/bin/hello_elixir remote"
  ```

  ```output output theme={null}
  Connecting to hello_elixir.internal... complete
  Erlang/OTP 23 [erts-11.2.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]

  Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)
  iex(hello_elixir@fdaa:0:1da8:a7b:ac4:b204:7e29:2)1>
  ```
</CodeGroup>

You have a live IEx shell into your application!

<Info>
  **Tip:** One of several ways to [exit the IEx shell](https://hexdocs.pm/iex/IEx.html#module-exiting-the-shell) is to hit `Ctrl+C, Ctrl+C`; to log out of the VM console, use `Ctrl+D` or `exit`.
</Info>

<Info>
  The `--pty` flag tells the SSH server to run the command in a pseudo-terminal. You will generally need this only when running interactive commands, like IEx.
</Info>

## Creating a Shell Script for Convenience

In UNIX-based operating system like Linux and Mac OS, we can create a shell script to make connecting to the server with an IEx terminal easy. The same can be done with a Windows PowerShell script or batch file.

However we name the file will be our "command" for opening the IEx shell into the server. Here we'll use `fiex`, short for "Fly IEx".

```shell theme={null}
#!/bin/bash

set -e

fly ssh console --pty --select -C "/app/bin/hello_elixir remote"
```

The `--pty` flag supports our interactive terminal and is needed to support the `--remsh` option used when we call `remote`.

The `--select` flag will prompt for which instance to connect to. This is handy when deployed to multiple regions and we want to be explicit about where we connect.

Remember to make the script executable: `chmod +x fiex`.

Using a terminal from the app directory, type `./fiex` to quickly jump into an IEx shell on the server.

<h2 id="whats-next">
  What's Next?
</h2>

With another quick update we can prepare our application for clustering by naming our nodes differently.

Next up, [Clustering Your Application](/elixir/the-basics/clustering)!
