0

I have an Amazon S3 bucket hosting some images for a static website. To keep things simple, I made folders in the bucket publicly readable with "make public using ACL" in the web console (so I can just link to the images from elsewhere).

I want to set up a budget limit on this bucket so I don't wake up to a huge S3 charge if it gets Reddit-hugged etc. Can I make a Budget Action that disables public read access for an S3 bucket (folder)?

None of the built-in budget actions in the web console seem relevant. The bewildering AWS docs mention something about SCPs but I don't see those could apply here. Someone else asked a similar question here but got no answers.

So far I've

  1. Made my bucket and the files in it publicly readable (that's the point)
  2. Attached a user-defined tag (eg "budget_limit_foo") to the bucket
  3. Activated this tag as a cost allocation tag
  4. Created a budget in the Billing Console set to Fixed Budget, Blended Costs, and using tag "budget_limit_foo" as a filter dimension.
  5. Created a budget alert with threshold at 90% (that's the one that'll trip the action)
  6. Gotten to "attach actions" in the "Create Budgets" template and hit a wall.

And to clarify, I only want to disable public read — or file transfer out — on this one bucket when it hits its limit. I'd prefer it didn't delete the files!

Crashworks
  • 40,496
  • 12
  • 101
  • 170
  • This can be addressed using a custom code deployed lambda function that gets triggered based on the budget threshold. A similar flow is available in this article. https://aws.amazon.com/blogs/mt/smart-budgeting-using-lambda-and-service-catalog/ – Amal G Jose Dec 30 '22 at 00:09

0 Answers0