-
Clone the Repository: Open your terminal and clone the repository to your local machine using the following command:
git clone https://github.com/fredritchie/hypha-3-tier.git
-
Open the Folder in VS Code: Navigate to the cloned folder (
hypha-3-tier
) using the terminal and open it in Visual Studio Code:cd hypha-3-tier code .
-
Modify Variables: Inside the folder, locate the
variables.tf
andbackend.tf
files. These files contain the Terraform variables and backend configuration. Modify the variables invariables.tf
as per your requirements. Thebackend.tf
file specifies the backend configuration, such as the S3 bucket to store Terraform state. Adjust it if needed. -
Initialize Terraform: Move to the
terraform
folder within the repository using the terminal:cd Terraform
Then, initialize Terraform to download the necessary providers and modules:
terraform init
-
Plan Terraform Deployment: Run Terraform plan to preview the changes that will be applied:
terraform plan
-
Apply Terraform Configuration: If the plan looks good, apply the Terraform configuration to create the infrastructure:
terraform apply -auto-approve
-
Update Static Content: Change your current directory to the static content folder containing your HTML files and images.
-
Update HTML File with ALB DNS: Open the
index.html
file in Visual Studio Code and replace the placeholder with the DNS name of the Application Load Balancer (ALB) obtained from the Terraform output. -
Upload Files to S3 Bucket: Using the AWS CLI, upload the
index.html
,background.jpeg
, andlogo.jpeg
files to the S3 bucket created by Terraform:aws s3 cp . s3://bucket-name/ --recursive
Replace
bucket-name
with the name of your S3 bucket. -
Access the Static Website: Once the files are uploaded, you can access the static website by visiting the S3 bucket URL in a web browser. Clicking on the hyperlink in the
index.html
file should redirect you to the web application running on the EC2 instance behind the ALB.
lionhuntdig / 3-tier-cicd Goto Github PK
View Code? Open in Web Editor NEWThis project forked from fredritchie/3-tier-cicd