How to attach an elastic load balancer with ec2 instance using Terraform

+2 votes

Hi Guys,

I have created one ELB in AWS. Now I want to attach this load balancer with EC2 instance using Terraform code. How can I do that?

Aug 17, 2020 in Terraform by akhtar
• 38,260 points
2,926 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use aws_elb_attachment resource in Terraform. This is used to attach ELB with an instance. I have attached one example below for your reference.

resource "aws_elb_attachment" "baz" {
  elb      = aws_elb.bar.id
  instance = aws_instance.foo.id
}
answered Aug 17, 2020 by MD
• 95,460 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,460 points
4,370 views
+2 votes
1 answer

How to create elastic load balancer using Terraform?

Hi@akhtar, You can use an aws_elb load balancer ...READ MORE

answered Aug 17, 2020 in Terraform by MD
• 95,460 points
3,912 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,213 views
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,460 points
863 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
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,901 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,616 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