• Stars
    star
    180
  • Rank 213,097 (Top 5 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AWS SSM EC2 SSH Proxy Command

aws-ssm-ec2-proxy-command Sparkline

Open an SSH connection to your ec2 instances via AWS SSM without the need to open any ssh port in you security groups.

ⓘ Prefer ec2-instance-connect implementation if possible
ⓘ Windows users please refere to README.windows.md

Prerequisits

Install SSH Proxy Command

  • Move proxy command script aws-ssm-ec2-proxy-command.sh to ~/.ssh/aws-ssm-ec2-proxy-command.sh
  • Ensure it is executable (chmod +x ~/.ssh/aws-ssm-ec2-proxy-command.sh)
Setup SSH Config [optional]
  • Add ssh config entry for aws ec2 instances to your ~/.ssh/config. Adjust key file path if needed.
    host i-* mi-*
      IdentityFile ~/.ssh/id_rsa
      ProxyCommand ~/.ssh/aws-ssm-ec2-proxy-command.sh %h %r %p ~/.ssh/id_rsa.pub
      StrictHostKeyChecking no

Open SSH Connection

  • Ensure AWS CLI environemnt variables are set properly e.g.
    • export AWS_PROFILE=default or AWS_PROFILE=default ssh ... <INSTACEC_USER>@<INSTANCE_ID>
  • If default region does not match instance region you need to provide it
    • e.g. <INSTACEC_USER>@<INSTANCE_ID>--<INSTANCE_REGION>
SSH Command with SSH Config Setup

ssh <INSTACEC_USER>@<INSTANCE_ID>

  • e.g. ssh ec2-user@i-1234567890
SSH Command with ProxyCommand CLI Option
ssh <INSTACEC_USER>@<INSTANCE_ID> \
  -i "~/.ssh/id_rsa" \
  -o ProxyCommand="~/.ssh/aws-ssm-ec2-proxy-command.sh %h %r %p ~/.ssh/id_rsa.pub"

Recommended Usage of ec2-instance-connect:SendSSHPublicKey

The advantage from a security perspective is that you don't need to grant ssm:SendCommand to users and there by the permission to execute everything as root. Instead you only grant ec2-instance-connect:SendSSHPublicKey permission to a specific instance user e.g. ec2-user.

More Repositories

1

docker-host

A docker sidecar container to forward all traffic to local docker host or any other host
Shell
1,027
star
2

maven-git-versioning-extension

This extension will set project version, based on current Git branch or tag.
Java
278
star
3

git-conventional-commits

Git Conventional Commits Util to generate Semantic Version and Markdown Change Log and Validate Commit Messag
JavaScript
211
star
4

aws-s3-bucket-browser

Single page application to browse AWS S3 bucket content
HTML
181
star
5

otp-authenticator-webapp

A 'Google Authenticator' like Single Page Application
JavaScript
93
star
6

zsh-lazyload

zsh plugin for lazy load commands and speed up start up time of zsh
Shell
78
star
7

gradle-git-versioning-plugin

This extension will set project version, based on current Git branch or tag.
Java
77
star
8

Jira-Issue-Card-Printer

Beautiful Issue Card Printer
JavaScript
69
star
9

banking-swift-messages-java

Banking SWIFT Library, MT Format Message Parser Writer SWIFT(Society for Worldwide Interbank Financial Telecommunication)
Java
29
star
10

time-timer-webapp

A CountDown and CountUp Timer
JavaScript
25
star
11

smart-life-webapp

JavaScript
20
star
12

my-zsh

handy and beautiful ZSH config
Shell
17
star
13

github-actions-access-manager

Manage access from GitHub actions workflows.
JavaScript
11
star
14

zjump

Simplify zsh directory navigation; jump to already visited, parent or sub folders.
Shell
10
star
15

zgem

zsh dependency manager 🐚 💎
Shell
10
star
16

unchecked-exceptions-java

Throw any Java Exception anywhere without the need of catching them nor wrapping them into RuntimeException
Java
7
star
17

aws-session

A CLI to generate and store session credentials in ~/.aws/credentials file, based on ~/.aws/config profiles
Python
6
star
18

aws-ec2-ssh-iam

AWS IAM managed EC2 SSH access
JavaScript
4
star
19

vercel-cors-proxy

JavaScript
3
star
20

gmail-rss-feed

Google Scripts Project to generate a RSS feed based on labeled emails
JavaScript
3
star
21

chrome-tab-multiselect-extension

JavaScript
3
star
22

meeting-cash-creep

Vue
3
star
23

userscript-kleinanzeigen-duplicate-ad

JavaScript
3
star
24

actions-publish-to-github-pages

GitHub Action to Publish Directory to GitHub Pages
Shell
3
star
25

chrome-tab-shift-extension

This extension will add a shortcuts to shift tabs.
JavaScript
2
star
26

junit-extension

Java JUnit Utils and Extentions
Java
2
star
27

domain-value-java

Domain Values
Java
2
star
28

zsh-theme-qoomon

zsh prompt theme
Shell
2
star
29

qoomon

About
2
star
30

zsh-history-search

zsh-history-search
Shell
2
star
31

aws-configure

A CLI to configure AWS named profiles in ~/.aws/config and ~/.aws/credentials files
Python
2
star
32

threema-web-desktop-app

Threema Standalone Web App with Dark and Light Mode Support
JavaScript
2
star
33

userscript-jira-dependency-indicators

JavaScript
2
star
34

kotlin-examples

Kotlin
2
star
35

userscript-aws-visual-account-indicator

This userscript reads the aws-userInfo cookie and adds account name and color indicator
JavaScript
2
star
36

aws-lambda-gitlab-webhook-to-datadog

JavaScript
2
star
37

userscript-jira-colored-labels

JavaScript
2
star
38

maven-enforcer-rules

maven-enforcer-rules
Java
2
star
39

chrome-tab-toggle-extension

This extension will add a shortcut to toggle through recent active tabs.
JavaScript
2
star
40

.github

1
star
41

chrome-new-tab-extension

Open neat blank page as 'New Tab' Page
HTML
1
star
42

chrome-search-engine-blocker-extension

Prevents Chrome from adding new search engines by opensearch link and search auto detection
JavaScript
1
star
43

diceware-webapp

HTML
1
star
44

userscript-disable-open-search

JavaScript
1
star
45

yolo-secret

TypeScript
1
star
46

chrome-show-password-extension

JavaScript
1
star
47

actions--set-env

TypeScript
1
star
48

cdn

cdn
JavaScript
1
star
49

self-signed-https-proxy

Shell
1
star
50

passphrase-generator

dice passphrase generator
Shell
1
star
51

google-chrome-launcher

Shell
1
star
52

chrome-tab-duplicate-extension

This extension will add a shortcut to duplicate tab.
JavaScript
1
star