In this tutorial, you will learn how to automatically deploy an Nginx Web Server on an EC2 instance, with Terraform.
Prerequisites
An ...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks, great point about user_data.
Yeah but for me I would use a bash script then under my Ec2 recourse for the user data I will supply the script file
This is outdated, here is the updated guide Nginx web server on EC2 instance with Terraform
LOL
thanks for this
Hi, great article!
I could be wrong but I think your Terraform file misses attaching the security group to the aws_ubuntu instance, no? :)
What connects the security group and the instance is the vpc_id, an ec2 instance or any resource in aws, needs to be created in a vpc, in this case default vpc was used and a security group was created that allows ssh etc. in the same vpc to be used by the ec2 instance.
"ec2 instance or any resource in AWS, needs to be created in a vpc..." - Not all resources in AWS need to be created in a VPC
For such resources, it’s desirable to have a vpc, even when it seems like is not needed. Plus without the VPC, most times an alternative is used i.e., AWS private link
Thanks so much for this clear and concise guideline Favour, I've just become your biggest fan. Is there a way to connect with you?
Also, I tried this and noticed the filters under the data section really made it difficult for terraform to find the infrastructures and apply them so i removed them to make the range wider.