How to create new AWS EC2 instance and assign EIP using Terraform?

In the other article we have seen how to create aws ec2 instance using Terraform. Now lets see how to create EIP and assign to the EC2 instance automatically using Terraform.

In the below example you can insert your provider access key and secret key information’s.

Here “aws_eip_association” will do the mapping function for EC2 id and EIP id .

#terraform plan
#terraform apply

Leave a Reply