- Create a user in AWS and assign the appropriate permissions to interact with AWS components (EC2, SSM, etc)
- Launch free tier EC2 instance in AWS
- SSH to EC2 or connect directly from the AWS console
- Install all dependencies and complete AWS configure with the previously created user
sudo yum update -yssh-keygen -t rsasudo yum install git -yInstall Terraform in EC2 instance Follow the instructions at https://learn.hashicorp.com/tutorials/terraform/install-cli
Pull the existing terraform code from the repo
git clone https://github.com/stan-gray/terraform_setup_devops.gitNavigate inside the project folder
cd terraform_setup_devopsInitialize the Terraform working directory, and download the required providers:
terraform initValidate the code to look for any errors in syntax, parameters, or attributes within Terraform resources that may prevent it from deploying correctly. You should receive a notification that the configuration is valid.
terraform validateReview the actions that will be performed when you deploy the Terraform code.
terraform planIn this case, it will create resources as configured in the Terraform code. When prompted, type yes, and press Enter.
terraform applyIn the output, you should see the public IP of the webserver. Here is the example:
Outputs:
Webserver-Public-IP = "35.175.111.230"Copy an IP address and add "/index.php" (35.175.111.230/index.php) Paste it to the browser tab.