DevOps Pro

Best AWS, DevOps, Serverless, and more from top Medium writers.

Follow publication

Member-only story

Terraform — Setting Up WAF on CloudFront

Prashant Bhatasana
DevOps Pro
Published in
3 min readOct 3, 2024

Setting up a Web Application Firewall (WAF) on Amazon CloudFront using Terraform is a powerful way to protect your web applications from common web exploits and vulnerabilities. AWS WAF helps you monitor HTTP and HTTPS requests, control access based on conditions, and filter out malicious traffic. Terraform, an infrastructure as a code tool, allows you to automate and manage your AWS resources efficiently. This guide will walk you through the steps to set up AWS WAF on CloudFront using Terraform.

Prerequisites

Before starting, ensure you have the following:

  1. AWS Account: An active AWS account with the necessary permissions.
  2. AWS CLI: AWS CLI should be configured with your AWS credentials.
  3. Terraform Installed: Terraform must be installed on your local machine. You can download it from Terraform’s official site.

So, let’s start!

→ Create a “provider.tf”

The provider file tells Terraform which provider you are using.

provider "aws" {
alias = "source"
region = "${var.region}"
profile = "<source-profile-name>"
}

→ Create “variables.tf”

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

DevOps Pro
DevOps Pro

Published in DevOps Pro

Best AWS, DevOps, Serverless, and more from top Medium writers.

Prashant Bhatasana
Prashant Bhatasana

Written by Prashant Bhatasana

AWS Community Builder | AWS Certified | Terraform Associate | SR. DevOps Engineer, Love to work with #AWS #GCP #Terraform #Jenkins #Kubernetes #Docker #Ansible

No responses yet

Write a response