How to launch one MySQL instance using Terraform code

0 votes

Hi Guys,

I want to launch one instance for MySQL 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,180 points
164 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" "mysql" {
  ami           = "ami-0019ac6129392a0f2"
  instance_type = "t2.micro"
  subnet_id = aws_subnet.private.id
  vpc_security_group_ids = [aws_security_group.mywebsecurity.id]
  key_name = "mynewkey"
  availability_zone = "ap-south-1b"
 tags = {
    Name = "mysql"
  }
}
answered Sep 9, 2020 by MD
• 95,140 points

Related Questions In Terraform

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,140 points
1,292 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,140 points
3,319 views
0 votes
1 answer

How to launch an instance in GCP using Terraform?

Hi@akhtar, You can use the google_compute_instance resource in ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,140 points
130 views
0 votes
1 answer

How to create one key in AWS using terraform?

Hi@akhtar, You can use aws_key_pair resource n terraform. ...READ MORE

answered Jun 11, 2020 in Terraform by MD
• 95,140 points
644 views
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

How to launch one EC2 instance for WordPress using Terraform?

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

answered Sep 9, 2020 in Terraform by MD
• 95,140 points
136 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,140 points
1,234 views