Live data from Hacker News

AWS Nuke – delete all resources associated with AWS account

github.com

111–120 of 124 posts

Re: AWS Nuke – delete all resources associated with AWS account

#111
post #35

Earlier quoted context omitted.

It seems to me this cannot possibly be a hard limit. If it’s a hard limit it’s only because AWS wants to milk you dry.

I suspect it’s a hard limit to prevent disgruntled (former) admin blast radius.

Given that the potential disgruntled admin already has access to nukes, this seems useless.

Re: AWS Nuke – delete all resources associated with AWS account

#112
post #34
post #25

Earlier quoted context omitted.

No, Batch's interaction with IAM roles and permission is super weird and not at all documented. It is easy to screw it up.

Aws batch is a terrible product

AWS is a terrible product, unless you happen to be in specific corners they've bothered to document/make their UI architecture not a horror show.

Re: AWS Nuke – delete all resources associated with AWS account

#114

so i have this weird monthly charge I cannot for the love of god find out what is causing it. I cancelled my credit card and now my credit score has taken a hit. All because some unknown AWS service that is in some zone that I cannot find at all and neither can AWS support.

I love how everyone wants to help you/figure out the mystery bug, because, after all, you just need knowledge and experience to maybe avoid getting screwed around by AWS.

Re: AWS Nuke – delete all resources associated with AWS account

#115
post #38

99% of our AWS resources are terraformed, but developers constantly push back / want to use the console to create stuff to test or play around with. So we setup a separate "hack" AWS account and give them admin access in there, and have an automated job using AWS Nuke to delete everything in there once a quarter.

We give each one of our developers their very own aws account managed through AWS organizations service. They are full administrators and responsible for resources and cost. So far we haven’t had any issues or bad surprises, although we have setup some aws billing alerts just in case. Feel free to make them responsible for cost and resources and you’ll be surprised how well they can manage their own account.

I think it really depends upon a number of factors but even pretty smart people can make stupid mistakes, especially when it comes to security in AWS. I’m familiar with several cases where engineers fired up old AMIs and got the instances compromised within an hour because they were running old, vulnerable software and ran it in a publicly routable subnet. There’s some basic rules to follow that can help avoid issues like those though that as organizations scale need to enforce to a greater degree eventually. Disallowing provisioning their own VPCs, disallowing publicly routed subnets, and establishing some decent auth infrastructure is all a good start that will work for a long time and have minimal friction for users. I’m a strong believer in security as a UX problem where doing the Right Thing should be easier than doing the Lazy / Bad Thing so I feel if people are having issues doing things the right way I’ve messed up and need to improve usability and meet my users where they are to achieve my own goals of a secured infrastructure.

Giving people responsibility and autonomy also comes with some responsibilities by the providers in a shared responsibility model is all I’m saying and every policy works out fine until it doesn’t.

Re: AWS Nuke – delete all resources associated with AWS account

#116
post #107
post #102

Earlier quoted context omitted.

> You can’t block role deletion because they are associated with resource, that would be a functional nightmare. Asserting this doesn't actually make your argument for you. Why would this be a problem?

It doesn’t make any sense. Forgive me for saying this, but if you don’t really know how all this works then it’s a convenient throwaway thing to suggest. So I think it’s up to you to explain how this would work when there is no difference between a role being deleted and a role being inaccessible . What exactly would you do if I block instance with the ID “xyz” from assuming the role I have assigned it? How would you…

That's an inline policy which is attached to the role. And notably AWS roles require all policies to be removed before they're deleted (which I know because I spent a bunch of time recently fixing ordering issues with CloudFormation deletes).

Again you keep just asserting this isn't possible: why? AWS are aware you need the role to exist to delete the instance (as noted up in the OP), why apparently is it completely inconceivable that the IAM system would check for this condition before executing an action - which again - irreversibly wedges a delete operation for a resource?

Unless you have some deep knowledge of how AWS IAM is implemented which makes this literally impossible, then you're asserting fluff.

Re: AWS Nuke – delete all resources associated with AWS account

#117
post #73
post #29

Earlier quoted context omitted.

Oh that would be glorious. Not sure how it'd be possible though.

I've hitherto assumed it didn't because it wasn't, short of calling every single `*:Describe*` API anyway. But the existence of aws-nuke makes me think (I haven't looked into what it's doing yet) there must be a better way of discovering used services/resources. Through billing perhaps?

We've built an (open source) asset inventory product just for that use case, to continuously discover all inventory, not just what's provisioned by Terraform (or Pulumi, etc.).

Link to the repo in my HN profile.

Re: AWS Nuke – delete all resources associated with AWS account

#118
post #88
post #83

Earlier quoted context omitted.

That's one of my big complaints with terraform, and it's state-based system. It doesn't inform you if there are resources you don't know about.

It is a feature and a good one (with a caveat though). terraform is best used on a per solution basis: one solution, one dedicated terraform project that will manage its state and its own state only. Multiple projects and people work carry out work in the same cloud account in parallel, and their terraform projects are not meant to interfere with each other. It works best for solutions that make use of fully managed…

Each of your projects could use a distinct terraform workspace; the hypothetical `terraform --nuke` would already need to look across all workspaces, considering all state. Or/also it could look at multiple remote states.

> Then there are also platform or connectivity level cloud resources (e.g. Transit Gateway and subnets that are mapped into the internal organisational network address space in AWS) that a random terraform project ought not to manage.

Not a 'random' one sure, personally I'd still want it somewhere. I suppose the hypothetical command might want an optional whitelist of non-tf-managed stuff to ignore though. (But then, you could whitelist it just by writing the terraform and importing it?)

> Lastly, if there is an actual need, a resource that terraform does not know about can be manually imported

The hard/annoying part that I'd like this command for is discovering these resources. i.e. it's not just that terraform does not know about them, it's that I probably don't. Or at least I don't realise they're not captured in terraform.

A very easy one to overlook is security group rules: unless you define them inline in terraform (i.e. ingress/egress blocks on a security group resource) then adding additional rules outside of terraform does not cause a diff. So you might be testing them out by manually poking around, and then you forget to terraform them/remove them, and they're left there forever with terraform blissfully unaware, and if you ever happen to notice it might not be obvious whether they're needed or not.

Essentially, it'd be useful for enforcing that terraform's used for everything; maintaining 'IaaC' hygiene.

Re: AWS Nuke – delete all resources associated with AWS account

#119

Project sponsored by Azure ?

No, we use it to clean up after our Terraform integration-tests. It is not always possible to use `terraform destroy`, because it might happen that the state does not allow it (at least that was our experience a couple of years ago).
Post reply on HN