Building and Managing AWS VPC Infrastructure with Terraform.
--
Terraform is an “infrastructure as code” tool similar to AWS CloudFormation that allows you to create, update, and version your Amazon Web Services (AWS) infrastructure.
In this project, I am going to create a VPC network infrastructure using Terraform after which I will perform some operations to deploy my resource into the Cloud.
Terraform Initialize
Terraform Plan
Terraform Apply
Terraform DESTROY
Pre-Requisites
- You must have an AWS account to check if infrastructure resources was applied on AWS cloud.
- You have must Terraform install on your Visual Studio Code.
Pre-Deployment to make create a scalable VPC infrastructure with Terraform
- 1. Create a VPC
- 2. Internet Gateway — Associate to VPC
- 3. NAT Gateway — EIP, Associate to Public Subnet
- 4. Create a Public Subnet
- 5. Create a Private Subnet
- 6. Create a Private Route Table — Associate to Private Subnet
- 7. Create a Public Route Table — Associate to Public Subnet
- 8. Add Private Routes — Add route to route the traffic to NAT
- 9. Public Route — Add route to route to the traffic to Internet Gateway
- 10. Elastic IP
To Begin
1. Create a VPC
2. Internet Gateway — Associate to VPC
3. NAT Gateway — EIP, Associate to Public Subnet
4. Create a Public Subnet
5. Create a Private Subnet
6. Create a Private Route Table — Associate to Private Subnet
7. Create a Public Route Table — Associate to Public Subnet
8. Add Private Routes — Add route to route the traffic to NAT
9. Public Route — Add route to route to the traffic to Internet Gateway
10. Elastic IP
Terraform Init — The terraform init command is used to initialize a working directory containing Terraform configuration files.
Terraform Apply — The terraform apply command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan. After running the apply command about 12 resources were added
Terraform Destroy — Run terraform destroy — without — target argument. After successful destruction, import the target resources back in the state file. After running the delete command all 12 resources where deleted from the AWS Cloud.
In Conclusion — Terraform is a great way to manage Cloud resources in a single point of location for a faster and efficient way of managing and deploying resources within the shortest possible time.