Back to articles
Deploying a Highly Available Web App on AWS Using Terraform
How-ToDevOps

Deploying a Highly Available Web App on AWS Using Terraform

via Dev.toMary Mutua

Today’s Terraform work took me from a single configurable EC2 web server to a clustered, load-balanced deployment on AWS. The two big ideas I focused on were: using input variables to remove hardcoded values moving from a single server setup to a highly available architecture using an Application Load Balancer (ALB) and an Auto Scaling Group (ASG) From Hardcoded to Configurable A hardcoded Terraform setup works once, but it becomes difficult to reuse. If region, instance type, and port are written directly in main.tf , every change means editing the infrastructure code itself. That’s where input variables help. With Terraform variables, I could define settings like: AWS region EC2 instance type application port environment name server name and then reference them in Terraform with: var .< name > For example: variable "server_port" { description = "The port the server will use for HTTP requests" type = number default = 8080 } variable "instance_type" { description = "EC2 instance type"

Continue reading on Dev.to

Opens in a new tab

Read Full Article
7 views

Related Articles