{"repo":"raajheshkannaa/auto-close-aws-accounts","free":true,"listed":false,"github":"https://github.com/raajheshkannaa/auto-close-aws-accounts","clone":"git clone https://github.com/raajheshkannaa/auto-close-aws-accounts.git","description":"Automatically close AWS Accounts when moved to a specific Organizational Unit, such as SuspendedOU or ToBeDeletedOU or BlackHole 😛","language":"Python","stars":14,"topics":["aws","aws-security","aws-account-closure","aws-account-deletion","aws-account-management","cdk","lambda","automation","org-formation","python"],"license":"MIT","category":"workflow-automation","readme_excerpt":"Automatically Close AWS Accounts 😎 With a sigh of relief 😮‍💨 at last, AWS has recently announced a straight forward easy way to close an AWS Account using an Organizations API call. Objectives Accomplished 1. Automatically intiate Account Closure when moved to a specific Organizational Unit(OU). For example we could have a dumpyard OU named such as OldOU or BlackHole or something similar, you get the point. 2. We make use of a Lambda function which will be triggered when the MoveAccount event occurs, which means an account is being moved in the AWS Organizations realm. 3. We also have another EventBridge Rule trigger which will invoke the Lambda function every 30 days to workaround the 10% Account Closure Quota Restriction. More info here - https://docs.aws.amazon.com/organizations/latest/APIReference/API CloseAccount.html 4. We make use of the latest boto3 library, as the one which is used by Lambda is always couple minor versions behind and doesn't work with the recently announced API features. 5. All of this built and deployed as a CDK App 🔥 Explanation In the above gif example, We make use of Org Formation to update the yaml file which represents the AWS Organization as code , by adding the TestAccount002Account to the OldOU Organizational Unit. Run, org-formation update rk-org.yml cli command which will update the Organization structure. Once this is updated, the Lambda is triggered by the EventBridge event rule, based on the MoveAccount event. The lambda initiates t","default_branch":null,"files":null,"tree":[],"storefront":"/r/raajheshkannaa","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/raajheshkannaa/auto-close-aws-accounts/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}