Search…
Host and container auto-detection
Learn how Cased Shell's auto-detection feature works.
To ensure that your teams can quickly access the command-line tools they need - whether they exist on a long-lived host, or on a container created 45 seconds ago - Cased Shell can be configured to provide quick and easy access to those command-line prompts using our host auto-detection feature.

Overview

Cased Shell’s prompt auto-detection feature is configured with a list of queries and associated metadata designed to describe the results and connection options necessary to connect to a prompt.
You'll want to setup Cased Jump to get started.
The provided queries are run against your cloud provider’s APIs, and any returned results are presented to the user along with the included metadata. This powerful combination of queries and metadata allows you to provide one-click access to the tools your team needs, like a “Rails Console” link that automatically runs the bin/rails console command in a container named rails-prod-f567d6c running on i-456afc9 (after first establishing a connection to bastion-567cee7).

Supported cloud providers

Your infrastructure may include a frequently-changing collection of hosts. For this use case, Cased Shell includes a 'static' provider which allows statically configured hosts, or supports the dynamic listing of hosts using API calls against another provider. Currently, Cased Shell's prompt auto-detection feature discovers prompts by running queries against the EC2 and ECS APIs (AWS). Please contact us if you’d like to use Cased Shell to detect prompts on another provider!

Configuring prompt auto-detection

When using our supported Terraform-based ECS deployment, Cased Shell’s prompt auto-detection feature is enabled by providing a list of jump_queries to the Terraform module. Each query has three general parts: provider configuration, filters, and prompt metadata:
1
jump_queries = [
2
{
3
# Provider configuration
4
provider = "ec2" # ec2, ec2, or static
5
limit = 1 # optional, defaults to no limit
6
sortOrder = "desc" # optional, defaults to "asc"
7
sortBy = "startedAt" # optional, provider specific
8
9
# Filters
10
# See https://github.com/cased/jump#providers for a full list of filters for each provider.
11
filters = {
12
"tag:aws:autoscaling:groupName" = "*test*"
13
}
14
15
# Prompt metadata can be used to customize how this prompt is displayed,
16
# as well as influence how Cased Shell connects to this prompt.
17
prompt = {
18
name = "Newest test instance"
19
description = "The newest instance in the 'test' autoscaling group."
20
21
# Prompts can be "featured" above the fold by setting this value to true.
22
featured = true
23
24
# Labels can be used to filter and group related prompts together.
25
labels = {
26
environment = "test"
27
}
28
29
# If necessary, the SSH connection established when clicking on this prompt
30
# can be configured using the following fields:
31
# hostname = "example.com"
32
# ipAddress = "1.2.3.4"
33
# port = "2222"
34
# username = "root"
35
36
# If this prompt requires a key or username different from the default,
37
# you can set the following fields to prompt the user each time:
38
# promptForUsername = true
39
# promptForKey = true
40
41
# Additional commands can be run immedaitely after connecting to a
42
# prompt by setting the following fields:
43
# jumpCommand = "docker exec -it app-container"
44
# shellCommand = "./bin/rails console"
45
46
# If the instance that this prompt points has restricted access to
47
# its SSH ports to instances in another security group, you can instruct
48
# Cased Shell to automatically proxy the connection via _another_ prompt
49
# it knows about by using the `proxyJumpSelector` field, which expects a
50
# hash of labels that identify the prompt to proxy the connection through.
51
52
# proxyJumpSelector = {
53
# app = "bastion"
54
# }
55
56
}
57
}
58
]
59
Copied!

Examples

1
jump_queries = [
2
# The most recently launched bastion instance in the test cluster
3
{
4
provider = "ec2"
5
filters = {
6
"tag:aws:autoscaling:groupName" = "*bastion*"
7
"tag:cluster" = "*test*"
8
}
9
limit = 1
10
sortBy = "launchTime"
11
sortOrder = "desc"
12
prompt = {
13
name = "Bastion host"
14
featured = true
15
description = "newest bastion instance"
16
labels = {
17
environment = "test"
18
app = "bastion"
19
shell = "bash"
20
}
21
}
22
},
23
# All EC2 nodes in the test ECS cluster, proxied through the bastion host
24
# above.
25
{
26
provider = "ec2"
27
filters = {
28
"tag:aws:autoscaling:groupName" = "*test*"
29
}
30
prompt = {
31
name = "ECS node"
32
labels = {
33
environment = "test"
34
app = "ecs"
35
shell = "bash"
36
}
37
proxyJumpSelector = {
38
app = "bastion"
39
}
40
41
}
42
},
43
# A Rails console in the container called "rails" launched as a part of the
44
# "test-service" ECS service in the test ECS cluster, proxied through the
45
# bastion host above. This prompt is featured to provide one click access
46
# to the Rails console.
47
{
48
provider = "ecs"
49
filters = {
50
cluster = "test"
51
task-group = "service:test-service"
52
container-name = "rails"
53
}
54
limit = 1
55
sortBy = "startedAt"
56
sortOrder = "desc"
57
prompt = {
58
name = "Rails Console"
59
featured = true
60
description = "Use to perform exploratory debugging on the test cluster"
61
shellCommand = "./bin/rails console"
62
labels = {
63
environment = "test"
64
app = "rails"
65
shell = "rails"
66
}
67
proxyJumpSelector = {
68
app = "bastion"
69
}
70
}
71
},
72
# Allow access to a bash prompt on all Rails containers on the test cluster.
73
{
74
provider = "ecs"
75
filters = {
76
cluster = "test"
77
task-group = "service:test-service"
78
container-name = "rails"
79
}
80
prompt = {
81
name = "Bash on rails container"
82
shellCommand = "/bin/bash"
83
labels = {
84
environment = "test"
85
app = "rails"
86
shell = "bash"
87
}
88
proxyJumpSelector = {
89
app = "bastion"
90
}
91
}
92
}
93
]
Copied!
The source of this complete integration may be useful if you'd like to configure host auto-detection in some other way.