EC2 auto discovery: allow usage of pre-defined AWS-RunShellScript SSM Document#60224
Merged
marcoandredinis merged 2 commits intomasterfrom Oct 21, 2025
Merged
Conversation
7058955 to
5e9815b
Compare
AWS-RunShellScript SSM DocumentAWS-RunShellScript SSM Document
5e9815b to
9cfd6cb
Compare
juliaogris
approved these changes
Oct 20, 2025
Contributor
juliaogris
left a comment
There was a problem hiding this comment.
LGTM, with some minor suggestions and questions.
I'm not really across this feature in depth, so this is a fairly superficial, code-only review.
9cfd6cb to
82eb427
Compare
Contributor
Author
|
@smallinsky Can you please take a look at this when you get a chance? |
smallinsky
approved these changes
Oct 21, 2025
Contributor
Author
|
@r0mant Flaky Tests Detector fails to complete in time because I've added a new required field to the DiscoveryService Config struct, and the detector is now running a ton of tests. I ran them locally with a higher timeout and they completed successfully: Can I please get a waiver on the check? |
Collaborator
|
/excludeflake * |
82eb427 to
e72198d
Compare
Contributor
|
@marcoandredinis See the table below for backport results.
|
This was referenced Oct 21, 2025
mmcallister
pushed a commit
that referenced
this pull request
Nov 6, 2025
…SM Document (#60224) * Use AWS-RunShellScript as the default SSM Doc in EC2 Auto Discover * escape url values
mmcallister
pushed a commit
that referenced
this pull request
Nov 19, 2025
…SM Document (#60224) * Use AWS-RunShellScript as the default SSM Doc in EC2 Auto Discover * escape url values
mmcallister
pushed a commit
that referenced
this pull request
Nov 20, 2025
…SM Document (#60224) * Use AWS-RunShellScript as the default SSM Doc in EC2 Auto Discover * escape url values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tldr: if you set the EC2 Discover SSM Document to
AWS-RunShellScriptyou don't need to create a custom SSM Document (per account/per region).EC2 Auto Discovery uses AWS SSM to install teleport into the EC2 target instances.
It calls
ssm.SendCommandto execute an SSM Document which installs, configures and runs teleport.The teleport instance running on the target instances will join the cluster afterwards.
In order to call
ssm.SendCommandwe need to pass an SSM Document.So far, we asked users to create a specific SSM Document
Whether using the docs EC2 Discover guide:
https://goteleport.com/docs/enroll-resources/auto-discovery/servers/ec2-discovery/ec2-discovery-manual/#step-37-create-ssm-documents
Or the WebUI:

This requires a moving piece which is really not necessary.
SSM Documents are per-region, which makes this an even worse problem, eg, #48532
This PR changes the discovery flow to ensure it knows about
AWS-RunShellScriptSSM document.This document is managed by AWS and exists in all accounts and regions, thus we don't need to create a custom SSM document.
This change also brings the EC2 server discovery implementation closer to the one used for
Azure:
teleport/lib/srv/server/azure_installer.go
Line 111 in 5d28371
GCP:
teleport/lib/srv/server/gcp_installer.go
Line 84 in 5d28371
In the future, the default SSM Document will be changed but for now users must set it in the matcher's SSM Document field.
Backwards compat:
Users which have an explicit SSM Document will see no change.
Users which have no explicit SSM Document (we default to TeleportDiscoveryInstaller) will see not change.
Only users that explicitly set the matcher's SSM Document to
AWS-RunShellScriptwill get the new flow.Docs will be updated with note explaining this change and marking the custom SSM Document creation step as optional.
WebUI flow should be updated afterwards to:
AWS-RunShellScriptin the DiscoveryConfig Matcherchangelog: Adapts EC2 Server auto discovery to send the correct parameters when using the
AWS-RunShellScriptpre-defined SSM Document.