Generate 'ssh_config' files, based on current Amazon EC2 state.
Project description
SSH config synchronisation for AWS
Generate ssh_config
files, based on current Amazon EC2 state.
Features
- Connect to one or more regions at once.
- Filter EC2 instances by name. Useful for including relevant nodes only or for creating separate config sets for the same environment (e.g. use a different
User
for different nodes). - Identify hosts using tags or instance IDs:
- Index duplicates (e.g. in autoscaling groups) using instance launch time.
- Include a global name prefix and/or a region ID to identify the connection in a unique way.
- Use public or private IPs.
- Set various SSH params:
- Skip strict host checking, if needed. Can be useful when working with (internal) autoscaling groups.
- Provide a server alive interval to keep the connection from timing out.
- Use custom identity files.
- Setup a proxy command for utilizing jump hosts.
- ...
- Write to
stdout
or a master file with config-key substitution. Useful for working with tools, that don't support theInclude
directive.
Installation
You can install the latest package using pip
:
pip install aws-ssh-sync
Usage
To get a full list of options:
aws_ssh_sync --help
Preview
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>
Utilising the 'Include' directive
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/*
Working with a single config file
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:
- Configuration is written to the
--output-file
rather thanstdout
. - If the file doesn't exist, then it will be created.
- If a section identified by
--config-key
exists, then it will be replaced. - If no
--config-key
was found, then a new section will be appended to the file. - No backup file is created at the moment.
References
- Origin, motivation and acknowledgements - blog post.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aws-ssh-sync-0.3.0.tar.gz
.
File metadata
- Download URL: aws-ssh-sync-0.3.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c6cf8c24d547fbf9fb45e995cde2ccde32cb6a97dc93c8331d393d23f3d1e11 |
|
MD5 | 4cb337bf916e2bc62a2d7ea9272f9ebe |
|
BLAKE2b-256 | aa9e1c43cbbbb356302999d99eed60b6fd25a83b4205da4c990108fb5c47f72b |
File details
Details for the file aws_ssh_sync-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: aws_ssh_sync-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48de27475f257770ef7713d5a3cbc844352f0350a0ec0dc98505b57ef6599e7c |
|
MD5 | e18730509d5c3e602755e1a42a9578b0 |
|
BLAKE2b-256 | 3139d952ed9fdd1be2723bf4f6661ff9e4dc5151fde993bc5e6b8b6fdc72e88a |