This guide provides the steps to deploy your application using Terraform. Follow these steps to set up your architecture and access your application via the web.
Before you begin, ensure you have the following prerequisites installed and configured:
- Terraform
- AWS CLI
- Access to an AWS account with necessary permissions
-
Initialise Terraform
Open a terminal in the root directory of your project and run the following command to initialize Terraform:
cd infra terraform init
-
Review the Terraform Plan and Apply Generate an execution plan for Terraform. This step allows you to see what resources Terraform will create, modify, or destroy. Carefully review the output to ensure that it matches your expectations and does not contain any unexpected actions.
terraform plan terraform apply
-
Access Application After Terraform successfully applies the configuration, it will output the DNS address of the Application Load Balancer (ALB) that routes traffic to your application. Look for an output named something like alb_dns_name:
Outputs: alb_dns_name = "your-alb-dns-name.eu-west-1.elb.amazonaws.com"
-
Shutdown After usage the app can be shutdown via Terraform (all data will be destroyed.)
terraform destroy