AWS AMI with Terraform
By: Kushagra Bansal
DevOps Enthusiast
STEP-1: Create an IAM user and provide ADMINISTRATOR ACCESS [imp ]
go to IAM > users> add user
STEP-2: create xyz.tf file and configure it.. such as add security key and access key.
STEP-3:
Now run Command: “terraform plan”
Basically, it creates an aws_instance of which u give ami id while configuring your ab.tf file
[remember it must be in the terraform folder ]
The terraform plan
the command is used to create an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files.
a.
b.
STEP-4:
Now run “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.
a.
b.
STEP-5:
Infrastructure managed by Terraform will be destroyed. This will ask for confirmation before destroying it.
Run: “terraform destroy ”
a.
b.
STEP_6:
Refresh your AWS webpage
It will take a few minutes.
You will First it show “SHUTTING DOWN” After Few Minutes “TERMINATED”.
A.
b.
Thank You !!!