This repository provides a simple way to create a re-deployable development environment on AWS using Terraform. With this environment, you can quickly provision AWS resources and launch an EC2 instance that you can access via remote SSH using Visual Studio Code on Windows, Mac, or Linux.
Before deploying this re-deployable development environment, ensure that you have the following prerequisites in place:
-
Visual Studio Code: Make sure you have Visual Studio Code installed on your machine. You can download it here.
-
Extensions: Install the following extensions in Visual Studio Code:
- Terraform: This extension provides syntax highlighting, linting, and more for Terraform files.
- AWS Toolkit: This extension helps you work with AWS resources within VS Code.
- Remote - SSH: This extension allows you to connect to remote systems over SSH.
-
AWS Credentials: Ensure you have AWS credentials configured on your machine. You can set up AWS CLI credentials using the
aws configure
command.
To deploy the re-deployable AWS development environment, follow these steps:
-
Clone this repository to your local machine:
git clone https://github.com/Nadav23AnT/aws-dev_env-terraform.git
-
Change to the repository directory:
cd aws-dev_env-terraform
-
Initialize Terraform:
terraform init
-
Plan the infrastructure changes:
terraform plan
-
Apply the changes to create the AWS resources:
terraform apply
-
Follow the on-screen prompts and confirm to apply the changes.
Once the deployment is complete, Terraform will provide you with information about the resources that were created, including the public IP address of the EC2 instance.
After deployment, you can remotely access the EC2 instance from Visual Studio Code using the following steps:
-
Open Visual Studio Code.
-
Install and configure the "Remote - SSH" extension if you haven't already.
-
Click on the "Remote Explorer" icon in the sidebar.
-
"connect to Host" and then Click on the right PUBLIC_IP
-
Enjoy development environment on AWS using vscode
You can now access your re-deployable AWS development environment within Visual Studio Code using the "Remote - SSH" extension.
To clean up and destroy the AWS resources created by Terraform when you no longer need them, you can run:
terraform destroy
Follow the on-screen prompts to confirm the resource deletion.
Note: Be cautious when using the terraform destroy
command, as it will permanently delete the AWS resources.
This project is licensed under the MIT License - see the LICENSE file for details.
This addition explains how to use the "Remote - SSH" extension and emphasizes the importance of using the correct public IP from the Terraform output.