Skip to content
James Bower
James Bower

Quantitative AI Security

  • Tools
  • Audit
  • Guides
  • Courses
  • Newsletter
James Bower

Quantitative AI Security

VSCode SSH and SSM: The Ultimate Combo for Sleek Remote Dev in AWS

James Bower, April 16, 2023April 23, 2023

VSCode SSH Introduction

So a major issue I had run into was being able to develop ML models on my local laptop using VSCode that is able to utilize AWS Sagemaker pipelines. A simple way around this is by hosting an EC2 instance in AWS that has Sagemaker permissions and then just setting up SSH to be able to connect from your laptop at home to that instance. My company prohibits the use of SSH so I had to come up with another way. Although SSH is not enabled we do allow AWS SSM (Systems Manager). So I spent days trying to figure out how to get this all connected and working and was finally able to.

Setup / Configuration

Mac Setup

  • Download and Install VSCode – https://code.visualstudio.com/
  • Download and Install the Remote – SSH Plugin from Microsoft – Visual Studio Marketplace
  • Make sure to have HomeBrew installed on your Mac as well – https://brew.sh/
brew update
brew upgrade
# Install AWS cli via brew
brew install awscli
# Install saml2aws via brew & Verify Version Installed
# https://github.com/Versent/saml2aws
brew install saml2aws
saml2aws --version
# Configure AWS CLI Config
# Modify it with your own roles
nano config
# Once finished modifying it, copy it to the AWS directory
cp config ~/.aws/config
# Install saml2aws Config
# Modify it with your own information
cp saml2aws ~/.saml2aws
# Run saml2aws to test everything
$ saml2aws login -a aws-dev -p aws-dev

Create an SSH Key Pair

# Create Your SSH Key Pair
ssh-keygen -b 4096 -C 'VS Code Remote SSH user' -t rsa
# To avoid any confusion with your existing SSH key I saved my key like so
/Users/James.Bower/.ssh/id_rsa-vscode

Create EC2 Instance

Log into AWS Console can create the appropriate EC2 Instance you would like to run VSCode Server on. Take note of the ID of the Instance.

Copy SSH Public Key to EC2 Instance

export AWS_PROFILE=aws-dev
export AWS_REGION=us-east-2
# Now we need to authenticate using Okta
saml2aws login -a aws-dev -p aws-dev
# Now we can connect to our EC2 Instance
aws ssm start-session --target instance-id
# Create or Edit ~/.ssh/authorized_keys if it exist
# And add your SSH Public Key to it.

Configure Local SSH

# Now you need to modify your local SSH config.
# This config is what VSCode needs in order to connect to
# your new EC2 instance.
# Create or Modify if exist.
nano ~/.ssh/config # On your local box
# Add the following after you modify it to fit your user role.
Host instance-id
  User ssm-user
  IdentityFile ~/.ssh/id_rsa-vscode
  ProxyCommand sh -c "saml2aws login -a aww-dev -p aws-dev; export AWS_PROFILE=aws-dev; export AWS_REGION=us-east-2; aws ssm start-session --target %h --document-name AWS-StartSSHSession --
parameters 'portNumber=%p'"

Test VSCode Connection to New EC2 Instance

Click in the bottom Left-hand corner an icon that looks like a “Lightning Bolt” Button.

vscode remote

Now you should be able to see the instance-id of your EC2 instance.

VSCode Server should now begin installing the server and your extensions on your EC2 instance and be able to begin remote development.

And thats that! I hope you have found this useful. Also make sure to keep coming back to my blog as I’m going to be putting out more text analytics and NLP posts here:

https://www.jamesbower.com/category/nlp/

And as always, thank you for taking the time to read this. If you have any comments, questions, or critiques, please reach out to me on our FREE ML Security Discord Server – HERE

AWS SSMVSCode

Post navigation

Previous post
Next post
  • Twitter
  • GitHub
  • YouTube
  • LinkedIn

Videos

https://www.youtube.com/watch?v=FEb8KZoEyzI&t=1291s

Categories

  • Active Defense
  • Anomaly Detection
  • AWS
  • Books
  • Business
  • CTF
  • Decision Intelligence
  • Deep Learning
  • Detection Engineering
  • EDA
  • Entity Recognition
  • Health
  • Linux
  • LLM
  • Machine Learning
  • Memory Forensics
  • NIDS
  • NLG
  • NLP
  • Operating Systems
  • Productivity
  • Python
  • Quantitative Security
  • Security Tools
  • Sentiment Analysis
  • Tech
  • Text Analytics
  • Threat Hunting
  • Threat Intelligence
  • Topic Modeling
  • UEBA

Recent Posts

  • Detection Rule Staleness: How AI Can Solve This Now
  • How to Think About Low-Latency Development with Python
  • Managing Noise In AI Security Machine Learning
  • Dimensionality Reduction: Find the Best Method for Your Data
  • Improved Anomaly Detection in Cybersecurity using Model Cascading

Tags

Apache BERT Boot2Root classification Conda Data Augmentation ddos Diet Dirb Ensemble ETL featured Firewall FreeBSD GPT-3 Hacking Hacking Challenge Htop Kioptrix LiME LLM low-latency Miniconda Mod_jk Monitoring NetworkMiner Nikto NLP NLTK Nmap Nokia 770 OpenAI OpenBSD PCAP pdfminer Peak Performance PF recon Security SSM Tomcat Volatility VSCode Word2Vec xgboost

Archives

  • April 2026
  • November 2024
  • October 2024
  • June 2024
  • October 2023
  • September 2023
  • August 2023
  • May 2023
  • April 2023
  • February 2023
  • March 2020
  • June 2019
  • July 2018
  • May 2018
  • August 2017
  • June 2017
  • February 2017
  • November 2016
  • October 2016
  • September 2016
  • April 2016
  • March 2016
  • November 2015
  • August 2015
  • June 2015
  • February 2015
  • September 2014
  • August 2014
  • July 2014
  • January 2014
  • June 2013
  • January 2012
  • September 2009
  • August 2009
  • September 2008
  • September 2006
©2026 James Bower | WordPress Theme by SuperbThemes