Skip to content

This Terraform project automates the provisioning of AWS infrastructure, including a Virtual Private Cloud (VPC), public subnet, internet gateway, route table, security group, and an EC2 instance. The project is designed to be flexible, allowing customization through variables for different environments.

Notifications You must be signed in to change notification settings

metahedgehog/terraform-aws-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AWS Terraform Infrastructure Deployment

This Terraform project automates the provisioning of AWS infrastructure, including a Virtual Private Cloud (VPC), public subnet, internet gateway, route table, security group, and an EC2 instance. The project is designed to be flexible, allowing customization through variables for different environments.

Prerequisites

Before running the Terraform scripts, ensure you have the following prerequisites:

  1. Terraform Installation: Install Terraform on your machine. You can download it from Terraform Downloads.

  2. AWS Credentials: Make sure you have AWS credentials configured on your machine with the necessary permissions for resource creation.

Getting Started

  1. Clone the Repository: Clone this repository to your local machine.

    git clone https://github.com/metahedgehog/terraform-aws-deploy.git
  2. Navigate to the Project Directory: Change into the project directory.

    cd terraform-aws-deploy
  3. Initialize Terraform: Run the following command to initialize Terraform in the project directory.

    terraform init
  4. Review and Modify Variables (Optional): Open the variables.tf file and review the variables. Modify them as needed based on your requirements.

  5. Run Terraform Plan: Execute the following command to see the plan of what Terraform will create.

    terraform plan
  6. Apply Terraform Changes: If the plan looks good, apply the changes.

    terraform apply
  7. Review Outputs: After the Terraform apply is complete, review the outputs to get information about the created resources.

    terraform output

    Save the outputs in a file for future reference.

Terraform Outputs

The following outputs are provided by the Terraform script:

  • ec2_public_ip: Public IP address of the EC2 instance.
  • ec2_ami: AMI ID of the launched EC2 instance.
  • ec2_type: Instance type used for the EC2 instance.
  • public_vpc_id: ID of the created VPC.
  • ec2_subnet_id: ID of the public subnet where the EC2 instance is deployed.
  • public_subnet_AZ: Availability Zone of the public subnet.
  • ec2_region: AWS region where the infrastructure is deployed.

Clean Up

To avoid incurring unnecessary costs, it's essential to destroy the created resources when they are no longer needed.

  1. Run the following command to see the plan for resource destruction:

    terraform plan -destroy
  2. If the plan looks correct, execute the following command to destroy the resources:

    terraform destroy

About

This Terraform project automates the provisioning of AWS infrastructure, including a Virtual Private Cloud (VPC), public subnet, internet gateway, route table, security group, and an EC2 instance. The project is designed to be flexible, allowing customization through variables for different environments.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages