Skip to content

stan-gray/terraform_setup_devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Deploy the code and access the webserver

Pre-req

  1. Create a user in AWS and assign the appropriate permissions to interact with AWS components (EC2, SSM, etc)
  2. Launch free tier EC2 instance in AWS
  3. SSH to EC2 or connect directly from the AWS console
  4. Install all dependencies and complete AWS configure with the previously created user
sudo yum update -y
ssh-keygen -t rsa
sudo yum install git -y

Install Terraform in EC2 instance Follow the instructions at https://learn.hashicorp.com/tutorials/terraform/install-cli

Steps

Pull the existing terraform code from the repo

git clone https://github.com/stan-gray/terraform_setup_devops.git

Navigate inside the project folder

cd terraform_setup_devops

Initialize the Terraform working directory, and download the required providers:

terraform init

Validate 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 validate

Review the actions that will be performed when you deploy the Terraform code.

terraform plan

In this case, it will create resources as configured in the Terraform code. When prompted, type yes, and press Enter.

terraform apply

In 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages