☁️Generate SSH config files, based on current AWS EC2 state.
Generate ssh_config
files, based on current Amazon EC2 state.
User
for different nodes).stdout
or a master file with config-key substitution. Useful for working with tools, that don’t support the Include
directive.You can install the latest package using pip
:
pip install aws-ssh-sync
To get a full list of options:
aws_ssh_sync --help
The easiest way to get a preview of the current config in AWS is to print the output directly to stdout
:
aws_ssh_sync --profile <profile> --region <region>
If you want to isolate the generated config, you can write it to a dedicated file, and Include
it in the main config. The base use-case is as follows:
aws_ssh_sync --profile <profile> --region <region> > ~/.ssh/config.d/<some_file>
To extend your ~/.ssh/config
, add the following line:
Include config.d/*
Splitting config into multiple, small files keeps things elegant and clean - you should probably stick to that, if you can.
Unfortunatelly, some tools may still have trouble with the Include
directive itself. If you want to use a single file (e.g. ~/.ssh/config
) for keeping all configuration, then you can specify the --output-file
together with a --config-key
:
aws_ssh_sync --profile <profile> --region <region> --config-key <key> --output-file <path>
Behaviour:
--output-file
rather than stdout
.--config-key
exists, then it will be replaced. --config-key
was found, then a new section will be appended to the file.