aws-dev-vm-tools

command module
v0.0.0-...-713e075 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2021 License: MIT Imports: 11 Imported by: 0

README

Utility for working with AWS EC2 development virtual machines

This is a small app for starting and stopping an EC2 instance, and fetching its public DNS name so that you can easily SSH into it (useful for VSCode Remote SSH). It currently uses STS and an MFA token to log into an IAM user account before interacting with EC2.

The driver script awsdev.sh demonstrates usage with environment variables to set up most of the configuration. The only mandtory argument is the MFA token code.

Setting up an EC2 instance

Create a new instance in EC2's console (I like m6g instances running Ubuntu) and download the PEM file to enable SSH login. Add the machine to the SSH config to enable SSH.

Host vscode-remote
  HostName ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com
  User ubuntu
  IdentityFile ~/.cert/vscode-remote-001.pem

Log into the machine and set up some basic utilities:

ssh vscode-remote
sudo apt update
sudo apt dist-upgrade
sudo apt install build-essential

Copy Git config (~/.gitconfig) over from local machine.

Copy NPM config (~/.npmrc) over from local machine.

Create an SSH key and add to GitHub.

Create a GPG key, add to GitHub and configure in Git client.

Add to the bottom of the bashrc file:

eval "$(nodenv init -)"
export EDITOR="vi"

eval "$(ssh-agent -s)" &>/dev/null
ssh-add ~/.ssh/id_github

Clone the repo and get set up.

git clone git@github.com/example/example.git

Build instructions

go build aws-dev-vm.go

Usage

awsdev -t TOKEN_CODE [start|stop|describe]

The public DNS address can be added to your SSH config as needed.

Using the machine for VSCode Remote SSH

If you have the extension installed, you should be able to "connect to host" and select the name of the host as specified in your SSH config.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL