A simple EC2 instance ready to be connected via Visual Studio Code Insiders via ssh.
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 you ssh key to create an AWS keypair later.
mkdir ssh_keys && ssh-keygen -f ./ssh_keys/mykey
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
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
terraform destroy --auto-approve