Skip to content

Instantly share code, notes, and snippets.

@tanelmae
Created November 22, 2021 07:35
Show Gist options
  • Save tanelmae/ba6152e761a48d071d12929480ddd98e to your computer and use it in GitHub Desktop.
Save tanelmae/ba6152e761a48d071d12929480ddd98e to your computer and use it in GitHub Desktop.
Connect to pod host with AWS SSM
function aws-pod-host-ssm() {
local NODE_NAME=$(kubectl get pods ${1} -o go-template='{{.spec.nodeName}}')
local PROVIDER_ID=$(kubectl get node $NODE_NAME -o go-template='{{.spec.providerID}}')
local INSTANCE_ID=${PROVIDER_ID#*//*/*/}
aws ssm start-session --target $INSTANCE_ID
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment