S3-hosted static website subject to DDoS attack?

I read about attacks that resulted in exorbitant billing, something that couldn’t happen when I used a commercial server-based hosting company (hosting.com). I’m set up for a notification when my monthly billing reaches a limit, but the DDoS attack could occur when I’m sleeping or on vacation, when I can’t respond right away to the notification.

Should I move my website back to hosting.com?


Related discussions:

I am planning to be a freelance solutions architect. Is the client's monthly billing my responsibility?
Am I charged for stopped reserved instances?
AWS setup for multiple accounts (engineering firm)
3 questions regarding AWS architecture
A story:I did a mistake in our AWS account that cost us 14,000$
AWS Account Hacked - Racked up $20,000 of Fraud Charges - MFA was enabled
AWS Claims They No Longer Support .ca TLD in Route 53
Need help. Billing says I have an EC2 IP address and key management but nothing is showing anywhere on the dashboard?
AWS Hacked $2k, unused account for 6+ years with expired CC
Almost half a million in accidental costs from EBS and ETL from a small startup
Find S3 cost breakdown retrospectively
AWS Activate Credits Mysteriously Exhausted
How do you gain access to an account where the root email no longer exisits
Is AWS cost optimization just intentionally confusing and perpetual?
Anyone using AI/ML for cloud cost anomaly detection? Beyond basic threshold alerts
Unexpected cross-region data transfer costs during AWS downtime
Any Advice on Billing?
I passed AWS SAA-C01 & I would not advise anyone to take it, rather go for SAA-C02!
AWS Tutorial - How to Create AWS Organization and Add Account
How to tackle CCP billing and cost questions
I've got charged while still using the AWS free tier.
SAP-C02 Sample Exam Questions question
Cost & Billing
Can AWS Console be cleaned up?
AWS just changed consolidated billing. Help needed
Monitoring hourly time of ec2
Amazon is billing me on free tier with barely any use?
Creating budgets and restrictions
The Agony and the Ecstasy of Cloud Billing
What's the right way to create a new account on AWS?
AWS: Moving an Instance to another AWS Accouny
The Post the AWS Billing Team Could Have Written About Multiple AWS Accounts-- But Didn't
Billing limit

Use CloudFront. Set up billing alerts. You can even set it up to shut down a service at a certain level.

Your bucket shouldnt be accessible on the internet only through cloudfront

Unless you have specific requirements such as setting access permissions on a per-object basis, check out Cloudflare R2. It uses the S3 API and behaves almost identically but there are no egress fees and you can keep it behind Cloudflare’s proxy. I recently moved our statically hosted product there and it’s been rock solid.

I assume you mean with a cloud watch metric and something like event bridge? So not out of the box.

It’s also worth noting that billing can take a while to update - I believe up to 24 hours. So any actions might happen a day after the issue.

Just to tack on here, the reason to use cloud front is because it supports AWS shield which is their service to provide ddos protection. Also, adding a waf on the cloud front with rate limiting can further mitigate cost based attacks.

CloudFront has flat price billing options now. Tie it to that, and it should cap the spending.

Posted it under sad-whale’s comment but use flat rate pricing with CloudFront, then you will max cap that single entry point: https://aws.amazon.com/blogs/networking-and-content-delivery/introducing-flat-rate-pricing-plans-with-no-overages/

Still add billing alerts because why not :slight_smile:

:index_pointing_up:
Shield standard is free. Paying for WAF may or may not be worth it depending on traffic, whether you can afford downtime, likelihood of an attack…

Not out of the box but easy enough to set up. You can find step by step instructions and code samples online.

You can link the same notification to a lambda which can bring the resource down to avoid any further problem.

CloudFront is the way

Not only because why not but also because they are free and it’s not only ddos attacks that can create large bills.

Personally, I’m not sure why they still make static public web hosting even an option, when CF is 100% superior, and doesn’t take that much additional configuration.

I do use CloudFront and I do have a billing alert. My concern is that isn’t enough. Below someone suggested a lambda to shut it down, but I’m not sure I want to add even more complexity. I’m not sure how do sufficient testing.

Could use a WAF with the DDoS protection rule but that has its own costs. Could do a broad manual rate limit rule.

The new flat-rate pricing in Cloudfront has a free option for hobbyists and beginners that even included DDoS protection and 5x WAF rules.

Important to note - you need to implement origin access control to make sure only cloudfront can access your bucket assets. Otherwise CF doesn’t help this problem at all.

Only down side is I can’t seem to see how to implement flat-rate pricing in the python CDK yet. It was only announced 3 week ago, so probably not yet available in IaC.

I don’t like the idea of enabling features and adding code to implement security. Complexity creates opportunities for system failure.

I mean, the obvious solution then is to shut down your website! You can’t have code failure if you have no code!

I joke, obviously. In seriousness, the lambda with billing alert is an option, but it’s overkill for this purpose. Look into Cloudfront’s new flat-rate pricing (announced earlier this month). There’s a free option, no overage fees, built-in security options, and you don’t pay for traffic from attacks.

i also didn’t see a way to enable via cdk, i had to enable it manually after deploying

Huge fan of AWS, but for a completely static site I’d recommend CloudFlare Pages (now deprecated in favor of CloudFlare Workers with static assets), since it’s completely free AND has no limits.

GitHub Pages is also free (no payment info even required) but has a soft bandwidth limit of 100GB per month.

The free plan on CloudFront (AWS CDN that goes in front of S3) supports up to 1M monthly requests.

As you’ve discovered, AWS in general is often not ideal for preventing denial-of-wallet attacks. Research into solving this exact problem for my own site on AWS was how I discovered CloudFlare’s offerings in the first place.