Skip to content

Instantly share code, notes, and snippets.

@ob1-sc
Created March 25, 2019 17:42
Show Gist options
  • Select an option

  • Save ob1-sc/153d755772258f39707678726b7cf3cd to your computer and use it in GitHub Desktop.

Select an option

Save ob1-sc/153d755772258f39707678726b7cf3cd to your computer and use it in GitHub Desktop.
Access managed ec2 instance via SSM
JUMPBOX_NAME="<name of ec2 instance>"
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=$JUMPBOX_NAME" \
--output text --query 'Reservations[*].Instances[*].InstanceId')
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