Utility to connect to ec2 instances through a bastion host.
Project description
ec2connect
Utility to connect to ec2 instances through EC2 Instance Connect
Prereqs
- Python 3.10+
- AWS CLI 2+
- An EC2 Instance Connect Endpoint setup and configured
- EC2 instances that support Instance Connect
- saml2aws (optional)
Installation
The easiest method is directly with pip, however virtual environments and pipenv are recommended
$ pip install ec2connect
or
$ pipenv install ec2connect
Configuration
If you are using saml2aws to log into AWS via a federated identity, ensure that it is configured first with credentials saved. You should be able to run saml2aws list-roles --skip-prompt and get a list of roles that saml2aws has access to without user interaction.
Next you can configure ec2connect. Just like saml2aws and the aws cli, it supports multiple profiles and will properly use those in those tools. You can pass the --profile <profile> option and this is the profile that will be used to store saml2aws credentials (optional) and that will be used for the AWS CLI calls (you can configure ~/.aws/credentials as needed as well)
These commands should be run in whichever Python environment you installed them. If using virtualenv, activate your environment. If using pipenv, use either pipenv shell or prefix the commands with pipenv run.
ec2connect configure
ec2connect --profile myprofile configure
Usage
For expanded help, use the --help flag on any command.
To SSH into an instance, use the following
ec2connect ssh
To drop a public key into Instance Connect for an instance to use (good for normal SSH connections or SCP file transfers)
ec2connect key
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ec2connect-2025.6.1.tar.gz.
File metadata
- Download URL: ec2connect-2025.6.1.tar.gz
- Upload date:
- Size: 51.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5060990d67db06942b998260680f77a843c2681a1873659ccbe2f14c7049d117
|
|
| MD5 |
5e199b47faea15357680417c057a9d3d
|
|
| BLAKE2b-256 |
fec699446cabfa896b11760a203d988a5c7653780005ef829adaf18942f29bd1
|
File details
Details for the file ec2connect-2025.6.1-py3-none-any.whl.
File metadata
- Download URL: ec2connect-2025.6.1-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb7d346a61bcf21569a825b5892934a8c10f3627c9e2587501cd36b7cb56459
|
|
| MD5 |
86baceafea02762bfe6ef134d9120d4c
|
|
| BLAKE2b-256 |
aa21d1ddefd771c21a11977aeb224787ec10af548e7f3d44bdf4404673373414
|