Terminating the EC2 Occurrence
As referenced before, terminating the terraform EC2 instance will remove it for all time, including any related storage and data. Make a point to take backups if necessary prior to terminating the instance.
Removing Terraform Resources: Removing command is necessary in order to ensure that all Terraform resources are properly destroyed. This order will dissect the Terraform state and eliminate every one of the assets oversaw by Terraform, including the VPC, subnet, security groups, and some other resources defined in your Terraform setup.
Run the following command in the directory where terraform project is located
terraform destroy
How to Create AWS EC2 using Terraform?
AWS EC2 (Elastic Compute Cloud) is a web service provided by Amazon Web Services (AWS) that allows users to launch and oversee virtual servers, known as examples, in the cloud. It gives an adaptable and versatile foundation for running different sorts of applications and jobs. With Terraform EC2, clients have unlimited authority over their virtual servers, including the capacity to pick the sort, operating system, and storage options of each instance.
Terraform is an open-source framework and code instrument created by HashiCorp. It empowers clients to characterize and arrange framework assets using a definitive language. Terraform upholds numerous cloud suppliers, including AWS, Azure, and Google Cloud Platform, allowing users to deal with their infrastructure reliably across various stages.