Live data from Hacker News

AWS Nuke – delete all resources associated with AWS account

github.com

101–110 of 124 posts

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

#101
post #11

Shout out to AWS batch, where if you delete the role assigned to a compute cluster the cluster itself becomes impossible to delete. Found this out after using AWS nuke

The idea that we can actually delete anything from a non physical system the hyper visor of which we do not control is absolute nonsense. Unless you have control over the physical system and the hypervisor all you can do is destroy your ability to access the information. We can never have confidence of how it truly works back end.

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

#102
post #69

Earlier quoted context omitted.

Wedging a cloud resource so you can't delete it is always a bug.

Maybe. But the GP above has a point. What does a role have to do with this particular resource. You can’t block role deletion because they are associated with resource, that would be a functional nightmare. You also can’t just cascade delete all resources associated to a role. The only real thing that can be done is assign the resource to some super user with all the rights so they can delete it instead.

> 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?

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

#103
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.

I've never used AWS Batch but heard only good things about it. If you could elaborate - i.e. warn me - I would very much appreciate it. What should I know before using AWS Batch?

First is the problem as described. If youndelete the ComputeEnvironment Role you can't delete the compute environment itself.

If you male a mistake setting up the Batch ComputeEnvironment using cloidformation and it rollbacks then the cloidformation error message is useless (resource failed to stabilise) and no trace is left behind for you to check.

Two, Batch needs to use servicelinkedroles. If you create an AWS thing that needs a servicelinkedrole via the console it gets creates for you automatically. If you created via CLI or Cloidformation it does not. So if someone has created a batch env in your account before it will probably be there but if you are setting up in a new account you might have no clue whu things arent working.

Compute Environments and JobSpecs that use Fargate are configured differenrly, requiring a extra IAM role, from EC2 batch envs.

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

#105

Earlier quoted context omitted.

I've never used AWS Batch but heard only good things about it. If you could elaborate - i.e. warn me - I would very much appreciate it. What should I know before using AWS Batch?

First is the problem as described. If youndelete the ComputeEnvironment Role you can't delete the compute environment itself. If you male a mistake setting up the Batch ComputeEnvironment using cloidformation and it rollbacks then the cloidformation error message is useless (resource failed to stabilise) and no trace is left behind for you to check. Two, Batch needs to use servicelinkedroles. If you create an AWS thi…

Thank you! You've probably saved me much head scratching down the line.

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

#106

Earlier quoted context omitted.

This is because neither AWS nor Azure use referential integrity in any of their "cloud scale" databases. For example, Azure uses some hideous JavaScript-based document DB where things like renames, moves, and deletes are hit & miss at best. A never-ending whack-a-mole of bugs and issues. Remember boys and girls: Being "cloud scale" means data corruption and referential integrity violation!

Not only referential integrity, but also not supporting Read-Your-Writes[1]. Cloud scale! Nothing like, 1. Create resource. Success. 2. Attempt to use/reference first resource in another resource/call: Failure: Referenced resource does not exist. Odd. 3. Create resource again? Failure! Resource already exists. Our scripts have so many retry loops and arbitrary pauses mixed in to account for garbage like this. Disting…

> Our scripts have so many retry loops and arbitrary pauses mixed in

This is unfortunately your fault, not Azure's. Their API is explicitly designed around this eventual consistency and weak references, so your client side must take this into account. Typical bash, Python, or PowerShell scripts are the Wrong approach with a capital W, and you will forever be tearing your hair out if you persist on using them. (Or any similar imperative deployment mechanism)

The only robust method is ARM Templates, or better yet, Bicep templates[1]. The latter simply compile down to ARM, so they're essentially equivalent but terser and with nicer tab-complete.

Compared to scripts, templates have key advantages:

1. Built-in incremental / differential deploy capability. A partially deployed template can be simply redeployed[2] to "fix it up", without requiring client-side logic for every corner case.

2. Can deploy multiple changes that would fail if deployed step-by-step. For example, App Gateway can have intermediate configurations that won't validate on the way to a valid final configuration. This is madness to unravel with scripts. Templates generally just take you to the final configuration in one step.

3. Inherently parallel. Anything that can be deployed concurrently will be. Anything. No need to write complex and error-prone parallel loops on the client side!

4. Largely immune to temporary failures like missing reads after writes.[3] The template engine has a built-in retry loop for most (all?) fallible steps. You'll see it has "failed"... and then "succeeded" anyway.

[1] https://docs.microsoft.com/en-us/azure/azure-resource-manage...

[2] Most of the time. All resources should be idempotent to redeployment, but many aren't because this is not mechanically enforced. IMHO, this is just shoddy, shoddy engineering and everyone involved should be ashamed. Being nearly idempotent is like being nearly pregnant.

[3] You still need a few tricks up your sleeve for robust deployments. Anything outside of ARM, such as Azure AD groups and RBAC tend to be a PITA. Generally you want to wrap your deployments in a script that takes the object GUID of the created group and feed that into the template. That works, because the GUID can be used even if the full object is not fully replicated around yet.

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

#107
post #102

Earlier quoted context omitted.

Maybe. But the GP above has a point. What does a role have to do with this particular resource. You can’t block role deletion because they are associated with resource, that would be a functional nightmare. You also can’t just cascade delete all resources associated to a role. The only real thing that can be done is assign the resource to some super user with all the rights so they can delete it instead.

> 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 detect that I’ve done this in every single case?

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

#108
post #70

Earlier quoted context omitted.

Yes, in the service that provides the AWS resource. Because it didn’t handle the fact that the role it’s using might be deleted or otherwise rendered un-assumable for a variety of different reasons at any point in time. Which is a feature. Not a bug.

I’m curious how you see this as a feature when it can get you into a very expensive and unresolvable situation; a AWS resource can’t be deleted and is running up costs. You’re at the mercy of AWS support.

Can it? The only case I know of involving roles specially is Batch, and the resources it’s trying (and failing) to clean up are ones with absolutely no cost.

It’s a feature because there are plenty of cases, such as a role being compromised, where you don’t want to cascade-delete every single associated resource without any need.

If you want this then you can opt into it by using cloudformation.

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

#109
post #61
post #38

Earlier quoted context omitted.

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.

> Feel free to make them responsible for cost and resources and you’ll be surprised how well they can manage their own account. Wow, this is horrible. I understand responsability but this is too much. Are other employees responsible if the company loses money for their actions?

Not sure what the problem is, if anybody exceeds the expected « normal usage » we simply get in touch and fix the issue.

Lessons learned for everybody, it’s a win-win situation.

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

#110
post #82
post #38

Earlier quoted context omitted.

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'm more worried about someone inexperienced with AWS accidentally doing something really expensive than any kind of intentional abuse.

If you make a mistake with excessive resources allocation, you can get in touch with aws and ask for a refund and they will gladly do so.

I’ve had to do it a couple of times for personal and profesional accounts, and I’ve never had any rejections from them

Post reply on HN