How to launch one EC2 instance for WordPress using Terraform

0 votes

Hi Guys,

I want to launch one instance in AWS using Terraform code. But I am new in Terraform. Can anyone tell me how can I do this task?

Sep 9, 2020 in Terraform by akhtar
• 38,260 points
849 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the aws_instance resource in Terraform. This helps us to launch an instance in AWS. But before that, you need the details of AMI ID, type, etc. You can take help from the below-given code.

resource "aws_instance" "WordPress" {
ami = "ami-000cbce3e1b899ebd"
instance_type = "t2.micro"
associate_public_ip_address = true
subnet_id = aws_subnet.public.id
vpc_security_group_ids = [aws_security_group.mywebsecurity.id]
key_name = "mynewkey"
availability_zone = "ap-south-1a"
tags = {
Name = "wordpress"
}
answered Sep 9, 2020 by MD
• 95,460 points

Related Questions In Terraform

0 votes
1 answer

How to attach an EBS volume to EC2 instance using terraform?

Hi@akhtar, You can use aws_volume_attachment resource to attach ...READ MORE

answered Jun 12, 2020 in Terraform by MD
• 95,460 points
8,865 views
0 votes
1 answer

How to do ssh in EC2 instance using Terraform?

Hi@akhtar, To ssh in your EC2 instance, you ...READ MORE

answered Jun 15, 2020 in Terraform by MD
• 95,460 points
7,195 views
0 votes
1 answer

How to launch one Pod in Minikube using Terraform?

Hi@akhtar, You can use kubernetes_pod resource to launch ...READ MORE

answered Jun 16, 2020 in Terraform by MD
• 95,460 points
3,392 views
0 votes
1 answer

How to attach Elastic IP in EC2 instance using Terraform code?

Hi@akhtar, You can use aws_eip resource in your ...READ MORE

answered Jul 22, 2020 in Terraform by MD
• 95,460 points
8,575 views
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

How to launch EC2 windows instance with powershell script using terraform?

Hi, In your Terraform code, you have written ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,460 points
4,306 views
0 votes
1 answer

How to launch one MySQL instance using Terraform code?

Hi@akhtar, You can use the aws_instance resource in Terraform. This ...READ MORE

answered Sep 9, 2020 in Terraform by MD
• 95,460 points
1,278 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP