Skip to main content

amazon ec2 - How to mitigate DDOS attacks on AWS?

I have web application (NodeJS) and I plan to deploy it to
AWS. To minimize the cost it will run on single EC2 instance. I'm worried though about
what will happen if someone decides to bless me with DDOS attack and hence have few
questions. Now, I did quite a bit of research, but as my understanding is clearly
lacking I apologise if some of the questions are plain
stupid:




  1. I want to
    avoid people flooding my site with layer 4 attacks. Would it be sufficient to set my
    Security Group to accept traffic only (in additions to SSH port 22)
    from:



    Type
    HTTP



    Protocol
    TCP




    Port Range
    80




Would above
stop UDP flood and others from hitting my EC2 instance?




  1. Via
    Security Group I would allow SSH connections to port 22 only from my static IP address.
    Would that keep attackers away from trying to attack port 22
    completely?


  2. My EC2 instance will run
    Ubuntu. I want to avoid application layer attacks (layer 7) and was planning to do it
    directly from my application, so somehow detect if certain IP floods particular URLs and
    block them if necessary. This however seems a bit late as the traffic already hits my
    web server and my server have to do the work anyway. So instead of doing this directly
    from my application I was thinking if that was possible to use IP tables to block any
    dodgy traffic before it comes to my web server. Is there set of some common settings
    that would be able to recognise rogue behaviour and block offenders? I was planning to
    look into fail2ban in hope this would simplify the process. Now, I do
    understand if it gets that far it will hit my EC2 instance anyway, but I want to protect
    my application also from e.g. brute force attacks.


  3. Would AWS CloudFront take care of
    most DDOS Layer 4 attacks? If not then using free href="https://www.cloudflare.com/plans/" rel="nofollow
    noreferrer">CloudFlare would make any difference?


  4. Say that someone floods my website
    anyway and this results in more traffic then I anticipated. Is there any way to stop
    charges at some point? There are billing alerts but I cannot see any way to set hard
    limits on AWS and say get instance offline if bandwidth
    exceeded.





I
also do realise that there is now way to completely prevent DDOS attacks but I want to
protect at least against basic attempts. Thank you in advance for any
help.

Comments