-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed issue with Ansible configured to use AWS SSM instead SSH #2209
Comments
I've never used it. But per design, using SSM connection feature will be always slower as using ssh. Because it's using S3 with multiple HTTP requests per TASK. |
Sort of. The setup for both SSH and SSM connections can be painfully slow, however with SSH the tool itself has a mechanism ("ControlMaster") for setting up persistent connections which most people use as a way to boost SSH performance. If you're a Red Hat Ansible customer, it's worth pushing for this module to get moved over to amazon.aws with official support added, in doing so it would be possible for the Cloud team to try and borrow some expertise from folks who've written the networking connection plugins which use Ansible's persistence support. |
I think it might be interesting to see how Packer handles this and take inspiration from it. Instead of entirely relying on SSM, it open an SSH tunnel through SSM. |
The issue I am having is that sometimes it just hangs indefinitely. I have tried setting It will usually run one or maybe two tasks. Then it will hang indefinitely. I am working remotely on a slow VPN... but I don't have these kinda issues with any other tool like Curl, SSH, and packer. |
Summary
I am trying to configure Ansible to use AWS SSM to connect to my EC2 instances instead SSH.
I have a playbook with a duration of approximatly 12 min when using SSH. With AWS SSM setup, this one takes 24 minutes,
so it takes twice as long which is a problem for me.
The playbook consists of classic tasks: install packages, setup permissions, configure elasticsearch...
I have investigate the root cause of this, it seems that setup SSM connection takes approximatly 3 seconds for each task, whereas it's instantaneous with SSH.
Below an exemple, with an Ansible task, in which setup the connection takes 3 seconds:
![ssm](https://private-user-images.githubusercontent.com/10061868/403488666-03df2865-10d7-406f-bbb4-6440816cd18f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODg3MTYsIm5iZiI6MTczOTM4ODQxNiwicGF0aCI6Ii8xMDA2MTg2OC80MDM0ODg2NjYtMDNkZjI4NjUtMTBkNy00MDZmLWJiYjQtNjQ0MDgxNmNkMThmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE5MjY1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlMzcyNmY3ODkzMTRlYmRlMGUyMDA5ZTE3OTlhMzkyZDA3MzAxZmYzZDc3ODYwNzYzODRkMDgyZWNmODI3MTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0JpwkUeBFby8GLu980vCKaqgsTfqKvRf4BEH5BsZddM)
I didn't find a lot of documentation on this issue (here: #1853 and here: https://forum.ansible.com/t/how-to-re-use-connection-across-tasks/38171) .
So I am creating this issue to track this (maybe it could also be a feature) and check if it's possible to improve speed or find othe solutions.
Issue Type
Bug Report
Component Name
community.aws.aws_ssm
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Debian 12, in a Docker container
Steps to Reproduce
Launch a playbook with AWS SSM connection configured.
Expected Results
Same duration of the playbook compared to using SSH connection.
Actual Results
Duration is twice as long in my case compared to using SSH connection.
Code of Conduct
The text was updated successfully, but these errors were encountered: