{"id":13701898,"url":"https://github.com/adhorn/aws-chaos-scripts","last_synced_at":"2025-05-05T04:30:33.381Z","repository":{"id":36156339,"uuid":"221657751","full_name":"adhorn/aws-chaos-scripts","owner":"adhorn","description":"DEPRECATED  Collection of python scripts to run failure injection on AWS infrastructure","archived":false,"fork":false,"pushed_at":"2023-10-18T01:16:45.000Z","size":22,"stargazers_count":92,"open_issues_count":2,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-13T09:40:10.717Z","etag":null,"topics":["amazon-web-services","aws","chaos-engineering","chaos-monkey","deprecated","software-engineering","sre"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adhorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-14T09:20:55.000Z","updated_at":"2023-10-25T07:16:14.000Z","dependencies_parsed_at":"2024-11-13T09:41:07.879Z","dependency_job_id":null,"html_url":"https://github.com/adhorn/aws-chaos-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhorn%2Faws-chaos-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhorn%2Faws-chaos-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhorn%2Faws-chaos-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhorn%2Faws-chaos-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adhorn","download_url":"https://codeload.github.com/adhorn/aws-chaos-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252439351,"owners_count":21747991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-web-services","aws","chaos-engineering","chaos-monkey","deprecated","software-engineering","sre"],"created_at":"2024-08-02T21:00:26.920Z","updated_at":"2025-05-05T04:30:33.050Z","avatar_url":"https://github.com/adhorn.png","language":"Python","readme":"## DEPRECATED in favor of AWS Fault Injection Simulator (FIS)\n\nhttps://docs.aws.amazon.com/fis/latest/userguide/fis-actions-reference.html#fis-actions-reference-fis\n\nAll scripts here have been ported to AWS FIS - See https://github.com/adhorn/aws-fis-templates-cdk\n\n⚠️USE AT YOUR OWN RISK⚠️\n\nUsing these scripts may create an unreasonable risk. If you choose to use the scripts provided here in your own activities, you do so at your own risk.\nNone of the authors or contributors, or anyone else connected with these scripts, in any way whatsoever, can be responsible for your use of the scripts contained in this repository.\nUse these scripts only if you understand what the code does\n\n## Collection of python scripts to inject failure in the AWS Infrastructure\n\n1. script-fail-az: simulate the lose of an Availability Zone (AZ) in a VPC.\n\n     ```shell\n        ❯ script-fail-az --help\n        usage: script-fail-az   [-h] --region REGION --vpc-id VPC_ID --az-name AZ_NAME\n                  [--duration DURATION] [--limit-asg] [--failover-rds]\n                  [--failover-elasticache] [--log-level LOG_LEVEL]\n\n         Simulate AZ failure: associate subnet(s) with a Chaos NACL that deny ALL\n         Ingress and Egress traffic - blackhole\n\n         optional arguments:\n         -h, --help            show this help message and exit\n         --region REGION       The AWS region of choice (default: None)\n         --vpc-id VPC_ID       The VPC ID of choice (default: None)\n         --az-name AZ_NAME     The name of the availability zone to blackout\n                                 (default: None)\n         --duration DURATION   The duration, in seconds, of the blackout (default:\n                                 60)\n         --limit-asg           Remove \"failed\" AZ from Auto Scaling Group (ASG)\n                                 (default: False)\n         --failover-rds        Failover RDS if master in the blackout subnet\n                                 (default: False)\n         --failover-elasticache\n                              Failover Elasticache if primary in the blackout subnet\n                                 (default: False)\n         --log-level LOG_LEVEL\n                                 Python log level. INFO, DEBUG, etc. (default: INFO)\n    ```\n\n2. script-stop-instance: randomly kill an instance in a particular AZ if proper tags.\n\n    ```shell\n         ❯ script-stop-instance --help\n         usage: script-stop-instance [-h] [--log-level LOG_LEVEL] --region REGION\n                                 --az-name AZ_NAME [--tag TAG]\n                                 [--duration DURATION]\n\n         Script to randomly stop instance in AZ filtered by tag\n\n         optional arguments:\n         -h, --help            show this help message and exit\n         --log-level LOG_LEVEL\n                                 Python log level. INFO, DEBUG, etc. (default: INFO)\n         --region REGION       The AWS region of choice (default: None)\n         --az-name AZ_NAME     The name of the availability zone of choice (default:\n                                 None)\n         --tag TAG             Filter instances by tag name:value (default:\n                                 SSMTag:chaos-ready)\n         --duration DURATION   Duration (s) before restarting the instance (default:\n                                 60)\n    ```\n\n3. script-fail-rds: force RDS failover if master is in a particular AZ or if database ID provided.\n\n    ```shell\n         ❯ script-fail-rds --help\n         script-fail-rds [-h] --region REGION --rds-id RDS_ID --vpc-id VPC_ID\n                     --az-name AZ_NAME [--log-level LOG_LEVEL]\n\n         Force RDS failover if master is in a particular AZ or if database ID provided\n\n         optional arguments:\n         -h, --help            show this help message and exit\n         --region REGION       The AWS region of choice. (default: None)\n         --rds-id RDS_ID       The Id of the RDS database to failover. (default:\n                                 None)\n         --vpc-id VPC_ID       The VPC ID of where the DB is. (default: None)\n         --az-name AZ_NAME     The name of the AZ where the DB master is. (default:\n                                 None)\n         --log-level LOG_LEVEL\n                                 Python log level. INFO, DEBUG, etc. (default: INFO)\n    ```\n\n4. script-fail-elasticache: force elasticache failover if primary node is in a particular AZ or if cluster name provided.\n\n    ```shell\n        ❯ script-fail-elasticache --help\n        usage: script-fail-elasticache  [-h] --region REGION --elasticache-cluster-name\n                           ELASTICACHE_CLUSTER_NAME --vpc-id VPC_ID --az-name\n                           AZ_NAME [--log-level LOG_LEVEL]\n\n         Force ElastiCache failover if master is in a particular AZ or if master node\n         ID provided\n\n         optional arguments:\n         -h, --help            show this help message and exit\n         --region REGION       The AWS region of choice. (default: None)\n         --elasticache-cluster-name ELASTICACHE_CLUSTER_NAME\n                                 The cache cluster name to failover. (default: None)\n         --vpc-id VPC_ID       The VPC ID where the primary node (master) is.\n                                 (default: None)\n         --az-name AZ_NAME     The AZ where the primary node (master) is. (default:\n                                 None)\n         --log-level LOG_LEVEL\n                                 Python log level. INFO, DEBUG, etc. (default: INFO)\n    ```\n\n## Install and build the scripts\n\nYou have two options. Choose _**one**_ of the options below\n\n* Building and using for production using Python Wheel\n* Building and using for dev or test (does not require Python Wheel)\n\n### Building and using for production\n\n1. Build a [wheel][wheel].\n\n   ```shell\n   pip install wheel\n   python setup.py bdist_wheel\n   ```\n\n1. The wheel file `chaos_aws-1.0.0-py3-none-any.whl` is in the the `dist` folder:\n\n   ```shell\n   cd dist\n   ```\n\n1. Install the wheel with pip.\n\n   ```shell\n   pip install chaos_aws-1.0.0-py3-none-any.whl\n   ```\n\n1. Run the script with its console script:\n\n   ```shell\n   script-fail-az --region eu-west-3 --vpc-id vpc-2719dc4e --az-name eu-west-3a --duration 60 --limit-asg --failover-rds --failover-elasticache\n   script-stop-instance --region eu-west-3 --az-name eu-west-3a --tag \"chaos:ready\"\n   script-fail-rds --region eu-west-3 --rds-id database-1\n   script-fail-rds --region eu-west-3 --vpc-id vpc-2719dc4e --az-name eu-west-3c\n   script-fail-elasticache --region eu-west-3 --vpc-id vpc-2719dc4e --az-name eu-west-3c\n   script-fail-elasticache --region eu-west-3 --elasticache-cluster-name chaoscluster\n   ```\n\n### Building and using for dev or test\n\n1. Install requirements\n\n   ```shell\n   pip install -r requirements.txt\n   ```\n\n1. Run the script with its console script:\n\n   ```shell\n   python scripts/fail_az.py --region eu-west-3 --vpc-id vpc-2719dc4e --az-name eu-west-3c --duration 60 --limit-asg --failover-rds --failover-elasticache\n   python scripts/stop_random_instance.py --region eu-west-3 --az-name eu-west-3a --tag \"chaos:ready\"\n   python scripts/fail_rds.py --region eu-west-3 --rds-id database-1\n   python scripts/fail_rds.py --region eu-west-3 --vpc-id vpc-2719dc4e --az-name eu-west-3c\n   python scripts/fail_elasticache.py --region eu-west-3 --vpc-id vpc-2719dc4e --az-name eu-west-3c\n   python scripts/fail_elasticache.py --region eu-west-3 --elasticache-cluster-name chaoscluster\n   ```\n\n[wheel]: http://pythonwheels.com\n","funding_links":[],"categories":["3. Fault Injection","Notable Tools"],"sub_categories":["Generic Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhorn%2Faws-chaos-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadhorn%2Faws-chaos-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhorn%2Faws-chaos-scripts/lists"}