Skip to content

AWS SSM Session wrapper. A simple wrapper script to simplify the starting of SSM sessions.

License

Notifications You must be signed in to change notification settings

aittam/AWSSSM-session-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AWSSSM-session-wrapper

AWS SSM Session wrapper. A simple wrapper script to simplify the starting of SSM sessions. It lists all your running EC2 instances in your default region and let you select which instance to connect to.

Requirements

To use this tool you need to install the following tools:

How to use it

This wrapper use the standard authentication chain used in boto3 hence you can take advantage of your profiles defined in ~/.aws/credentials and ~/.aws/config as explained here.

You can optionally provide a profile as a command line argument, use the default profile or the AWS_PROFILE environment variable.

Examples

Example 1

python3 ./ssmSessionWrapper.py --profile my-profile-dev
List of running instances:
[0]: linux-test1 - i-06bc4b6ce3c3c18e5 - Online
[1]: linux-test2 - i-01dc627cbfe388d77 - Online
Type the number of the instance you want to connect to: 1
Connecting to i-01dc627cbfe388d77

Starting session with SessionId: botocore-session-1556723767-06ea4aec0cb66907e
sh-4.2$

Example 2

export AWS_PROFILE=my-profile-stg
python3 ./ssmSessionWrapper.py --region eu-west-1
Enter MFA code for arn:aws:iam::123456789:mfa/name.surname:
List of running instances:
[0]: linux-test1 - i-02bz4b6de4c3c18f3 - Online
[1]: linux-test2 - i-03dc727cbfe388dd4 - Online
[3]: linux-test3 - i-07gc763cffe368df5 - ConnectionLost
Type the number of the instance you want to connect to: 0

Command line arguments

python3 ssmSessionWrapper.py -h
usage: ssmSessionWrapper.py [-h] [--profile PROFILE]

optional arguments:
  -h, --help         show this help message and exit
  --profile PROFILE  AWS profile
  --region REGION    AWS region

About

AWS SSM Session wrapper. A simple wrapper script to simplify the starting of SSM sessions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages