Skip to content

A simple EC2 instance ready to be connected via Visual Studio Code Insiders

Notifications You must be signed in to change notification settings

tul1/aws_EC2_vscode

Repository files navigation

AWS virtual machine for VSCode Insiders

Terraform Version VSCode Insiders Version vscode-remote-release

A simple EC2 instance ready to be connected via Visual Studio Code Insiders via ssh.

Get VScode insiders, VSCode remote extension and Terraform

Download and install VSCode insiders from here: https://code.visualstudio.com/insiders/

Install this extension pluggin in your VSCode: https://code.visualstudio.com/docs/remote/remote-overview

Download and install Terraform from here : https://www.terraform.io/downloads.html

Create your ssh key

Create you ssh key to create an AWS keypair later.

mkdir ssh_keys && ssh-keygen -f ./ssh_keys/mykey

Create your instance

Run the code in the box beneath and type 'yes' afterwards:

terraform init
terraform apply --auto-approve

To avoid typing your parameters everytime you launch this code you can create a local tfvars file containing your own specifications like this:

PATH_TO_PUBLIC_KEY  = "/your/path/to/mykey.pub"
PATH_TO_PRIVATE_KEY = "/your/path/to/mykey"
AMI_LOGIN_USR       = "ami_login"
INSTANCES_NUM       = 1

Connect to an instance with VSCode insiders

Modify instances number

This module will allow you to change the number of alive instances by running the following line:

terraform apply -target=aws_instance.my_instance -var INSTANCES_NUM=1

Destroy your instance

⚠️ AWS charges the minute for every alive instance, therefore, having an unattended or an unused vm could cost a lot. So, to destroy the machines you can run the following command:

terraform destroy --auto-approve

About

A simple EC2 instance ready to be connected via Visual Studio Code Insiders

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published