Create an instance in AWS using Terraform

Mundo DevOps
1 min readFeb 18, 2023

1 — Create a folder and access

mkdir terraform_first_project
cd terraform_first_project

2 — You will need to create a Terraform configuration file

touch main.tf

3 — Here is an example of what that file might look like:

This configuration file that we are using the AWS provide in the `us-west-2` region. It also creates a new EC2 instance using the specified Amazon Machine Image (AMI) and instance type.

4 — To create the instance, you can run the following commands in your terminal:

terraform init
terraform apply

The terraform init command initializes your working directory and downloads any required modules. The terraform apply command then creates the resources specified in your Terraform configuration file. After the command completes, Terraform will output the ID of the newly created EC2 instance. You can then log in to the AWS console to verify that the instance was create successfull.

--

--

Mundo DevOps

Mostrar o mundo da cultura Front-End descrevendo sua aplicação no dia a dia. Com solução de problemas e projetos. ✌️😎