Giter Club home page Giter Club logo

aws-waf's Introduction

AWS WAF & Shield

picture of article

About The Article

There are codes and file about article of "How to secure our resources from DDoS attacks with AWS WAF & Shield?". To see the article of aws-waf.

In this article, we will learn in detail about WAF, DDoS attacks, and Amazon WAF & Shield.

We will create the necessary environment for WAF test. For this, we will build an Application consisting of Static Web Server (EC2 instance), Load Balancer, Target Group. We will mitigate an application layer DDoS attack on the web server that we build, by defining rules and then by creating rule groups with defined rules and later by associating them to Web ACLs, step by step.

We will create a test script and apply it on our web server that we build. Then, we will examine and analyze the output on AWS WAF dashboard charts and CloudWatch.

Topics we will cover:

  1. What is WAF ?

  2. AWS WAF & Shield

  3. DDoS Attacks

  4. How to mitigate DDoS attacks?

  5. Mitigating attacks using AWS Shield Standart

    5.1. Creating Rule Groups and Rule

    5.2. Creating Web ACLs

  6. Test to web ACL

    6.1. Create a web application

    6.2. Build an Application (Static Web Server, ALB, Target Group)

  7. 2.1. Create an Apache Web Server with a static website at EC2 console

  8. 2.2. Create a Target group

  9. 2.3. Create Application Load Balancers (ALB)

  10. Control The Application that we created

  11. Create the test script

  12. Notice the output

  13. AWS WAF Dashboard Charts

  14. Subscribe to Shield Advanced

  15. As a result

  16. Next post

  17. References

You can build the following environment with cloudformation template to perform the tests mentioned in the article.

About aws-waf git hub repo

aws-waf repository root folder and terraform template folder contents are below:

picture of repository contents

  • user-data.sh : If you create manually instance, to use in user-data.
  • ddostest.sh : In order to create the test script.
  • cfn-template.yaml : In order to create an environment with CloudFormation Template.

Built With

picture of environment architecture

  • Create manually this enviroment above on your cloud provider. For this, follow the commands in item: "6.2. Build an Application (Static Web Servers, ALB, Target Group)" in the article.

  • Or build with CloudFormation

This CloudFormation Template creates Application Load Balancer with Auto Scaling Group of Amazon Linux 2 (XXXXXXXXXXXXX) EC2 Instances which host Python Flask Web Application. EC2 instances are placed within WebServerSecurityGroup which allows http (80) connections only from ALBSecurityGroup, and allows tcp(3306) connections only within itself. RDS DB instance is placed within WebServerSecurityGroup so that Database Server can communicate with Web Servers. Application Load Balancer is placed within ALBSecurityGroup which allows http (80) connections from anywhere. WebServerASG Auto Scaling Group is using the WebServerLT Launch Template in order to spin up instances needed. WebServerLT Launch Template is configured to prepare Python Flask environment on EC2.

Prerequisites

This deployment can be deployed to an AWS environment. AWS account is required to run this deployment. Use the following link to create an access key and a secret access key.

Git are reqired for this deployment.

Deployment

With CloudFormation Template

  1. Clone the repo and go to the deployment directory.
git clone https://github.com/cmakkaya/aws-waf
cd cfn-template/
  1. Change your key file path and your key name in cfn-template.yaml file correctly!

  2. Connect to AWS console.

Choose region as us-east-1.
Choose CloudFormation service
click on Create stack button
Choose Template is ready
Choose Upload a template file
click on "Choose file"  and then choose cfn-template.yaml in your local host.
click on Next button
Enter Stack name whatever you want
Choose your KeyName
Choose your MyVPC
Choose your Subnets
click on Next button
There isn't changing in page and click on Next button
Control the information in page and click on Submit button and wait buildig your environment.
  1. Follow the commands in the article.

Troubleshooting

If the step 3 (Building cloudformation template) fails, see fail code in "Events", you try to correct fail then run templete once again. If it keeps failing save the output logs and reach out to me on Github.

Cleanup

  1. If the deployment is not needed anymore, run the following command to delete the deployment. Enter yes when prompted.
Choose your "stack", and click on "delete stack"

Connect with me ๐Ÿ“ซ You can learn more about me

References for article

aws-waf's People

Contributors

cmakkaya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.