1. Home
  2. Training Library
  3. Amazon Web Services
  4. Courses
  5. Introduction to AWS Web Application Firewall

AWS WAF working with AWS CloudFront


2m 50s
Start course



Please note: This course has been replaced with a more recent version found here.


Security is one of the hottest topics within the cloud industry right now, mostly due to uncertainty and a lack of understanding when it comes to knowing how to secure the cloud really is. With this in mind, public cloud vendors focus massive effort and resources into security, resulting in additional levels of security at all layers within their cloud architecture.

This made way for the development of the AWS Web Application Firewall (WAF) service which was launched at Re:Invent in October 2015.

This course looks at all the elements of AWS Web Application Firewall from a beginners introduction to the service from what it is and when to use it within your environment, to how it can be used in conjunction with other services like AWS CloudWatch and AWS Lambda to help with automation of your security.

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.


Hello and welcome to this lecture on how AWS WAF and AWS CloudFront can work together.

As a pre-requisite of this lecture, you should have a basic understanding of AWS CloudFront. More information on CloudFront can be found here from our existing course.

AWS WAF relies heavily on AWS CloudFront distributions to the point that if you don't have distribution configured then you're not able to use and implement AWS WAF solution. However, it's worth mentioning that this service dependency relationship is only one way. Meaning that AWS CloudFront can operate and exist without AWS WAF being configured. AWS WAF also supports custom origins allowing you to apply the same level of security to web infrastructure managed outside of AWS.

As we saw in the demonstration earlier, the final step of configuring the service is to associate your web ACL to an AWS CloudFront distribution. When this association between the two services takes place, it can take approximately 15 minutes for the web ACL and associated rules to be propagated to all relevant edge locations linked with your CloudFront distribution. This propagation is automatically instigated by CloudFront. By propagating this configuration out to the edge locations it helps to ensure performance is maintained and latency is kept low by not having to perform these WAF checks at another location in an availability zone somewhere else across the world.

When a request is blocked by WAF, CloudFront is notified that the request was forbidden and CloudFront will return at 403 error to their browser. This is a standard error code when access to a HTTP resource is forbidden. This error doesn't really provide much information to the end user, and offers no reason as to why the error was generated. All in all it can be a bit frustrating for the end user. Creating your own custom 403 errors are much more professional, and you can guide the user to other useful links and provide a polite reason as to why they may have experienced the error. This creates a better user experience despite the user not being able to access the resource they were after. The next time the user is blocked by WAF, CloudFront will then display the custom error code instead.

Before working on your web ACLs, look at the CloudFront distribution that you intend on associating the web ACL to. The reason being is that when you are creating your CloudFront distribution, you can select what HTTP methods the AWS CloudFront will respond to and which ones it will not. Therefore, it would be inefficient to configure conditions that blocked against HTTP methods that would be dropped by CloudFront anyway. Instead, use a combination of the two. CloudFront configuration and WAF Web ACLs to process incoming requests effectively.

When creating your CloudFront distributions, you have an option during step two, create distribution, to select an existing AWS WAF Web ACL. So you don't have to associate your Web ACLs through AWS WAF. You can also change your Web ACL from within the AWS CloudFront console as well by selecting your distribution and clicking on edit under the General tab. From there you can then select a new Web ACL.

That's the end of this lecture. Coming up next, we look at WAF and automation.



About the Author
Learning paths61

Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.

To date, Stuart has created 80+ courses relating to Cloud reaching over 100,000 students, mostly within the AWS category and with a heavy focus on security and compliance.

Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.

He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.

In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.

Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.