This README provides instructions for using Terraform to automate the provisioning of an EC2 instance for development purposes on AWS. It enables you to use visual studio locally to communicate to the remote enviroment using (Remote-SSH) plugin.
Before you begin, ensure you have the following:
- AWS account credentials with appropriate permissions.
- Terraform installed locally. Install Terraform.
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Initialize Terraform:
terraform init
-
Review and Modify Variables:
- Open
variables.tf
orterraform.tfvars
to review and update any required variables such asaws_region
,instance_type
, etc.Feel free to customize# Example terraform.tfvars dev_region = "us-east-1" host_os = "unix" # Specify 'windows' if your host OS is Windows public_key_path_with_filename = "~/.ssh/dev-env-key.pub" private_key_path_with_filename = "~/.ssh/dev-env-key"
terraform.tfvars
with your specific variable values.
- Open
-
Review and Apply Configuration:
- Ensure
main.tf
aligns with your requirements. - Apply the Terraform configuration:
Follow prompts and confirm with
terraform apply
yes
.
- Ensure
-
Accessing the EC2 Instance:
- After Terraform completes provisioning, access the EC2 instance using SSH or appropriate methods.
- To remove resources managed by Terraform when no longer needed:
Confirm with
terraform destroy
yes
when prompted.
- Verify AWS credentials are correctly set in your environment (
~/.aws/credentials
or environment variables). - Adjust
main.tf
as needed for your specific deployment requirements.
For more information on Terraform and AWS:
This README guides you through setting up and managing an EC2 instance using Terraform, ensuring efficient and reproducible infrastructure provisioning for development environments on AWS. Adjustments to variables and configurations can be made as per your project's needs.