{"id":13820889,"url":"https://github.com/aws-samples/ec2-spot-interrupter-cli","last_synced_at":"2025-05-16T10:33:28.483Z","repository":{"id":137022520,"uuid":"472174569","full_name":"aws-samples/ec2-spot-interrupter-cli","owner":"aws-samples","description":"A CLI tool to simulate EC2 Spot Instances interruptions using AWS Fault Injection Simulator.","archived":false,"fork":false,"pushed_at":"2022-05-04T15:41:24.000Z","size":17,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-19T20:46:52.047Z","etag":null,"topics":["aws","aws-ec2","ec2-spot","fault-injection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-03-21T03:33:38.000Z","updated_at":"2022-11-08T10:41:59.000Z","dependencies_parsed_at":"2024-01-13T16:25:41.283Z","dependency_job_id":"dbc35fbf-042f-4a9b-b147-a0fb0747f507","html_url":"https://github.com/aws-samples/ec2-spot-interrupter-cli","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fec2-spot-interrupter-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fec2-spot-interrupter-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fec2-spot-interrupter-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fec2-spot-interrupter-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws-samples","download_url":"https://codeload.github.com/aws-samples/ec2-spot-interrupter-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254512897,"owners_count":22083478,"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":["aws","aws-ec2","ec2-spot","fault-injection"],"created_at":"2024-08-04T08:01:11.112Z","updated_at":"2025-05-16T10:33:28.142Z","avatar_url":"https://github.com/aws-samples.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ec2-spot-interrupter-cli\n\nA CLI tool to simulate EC2 Spot Instances interruptions using AWS Fault Injection Simulator (FIS).\n\nSince October 2021, You can trigger the interruption of an Amazon EC2 Spot Instance using AWS Fault Injection Simulator. When using Spot Instances, you need to be prepared to be interrupted. With FIS, you can test the resiliency of your workload and validate that your application is reacting to the interruption notices that EC2 sends before terminating your instances. You can target individual Spot Instances or a subset of instances in clusters managed by services that tag your instances such as Auto Scaling group, EC2 Fleet and EMR.\n\n## Install (macOS, Linux)\n\n1. Use [AWS CloudShell](https://aws.amazon.com/cloudshell/) or your favorite terminal, clone this repository.\n\n```bash\ngit clone https://github.com/aws-samples/ec2-spot-interrupter-cli.git\n```\n\n2. Change current directory to the downloaded repository folder.\n3. Run the install script:\n\n```bash\nsudo bash install.sh\n```\n\n## Getting started\n\nTo use this tool, you will need AWS credentials configured. Take a look at the [AWS CLI configuration documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#config-settings-and-precedence) for details on the various ways to configure credentials.\n\nPopulate the following environment variables with your AWS API credentials.\n\n```bash\nexport AWS_ACCESS_KEY_ID=\"...\"\nexport AWS_SECRET_ACCESS_KEY=\"...\"\n```\n\nSet the AWS_REGION environment variable if it's not configured.\n\n```bash\nexport AWS_REGION=\"...\"\n```\n\n## Synopsis\n\nesi interrupt\n\n-tk, --tag-key | Filter instances tag key  [required]  \n-tv, --tag-value | Filter instances tag value  [required]  \n[-dbi, --duration-before-interruption] | Number of minutes represents the duration after which the Spot instances are interrupted, must be between 2 and 15. Default is 2.  \n[-c, --count] | Number of instances to interrupt, between 1 and 1000. Default is 1.  \n[--confirm] | Flag to auto confirm interruption.  \n[-ir, --iam-role] | ARN of IAM role for FIS.  \n[--help] | Show help message.\n\n## Examples\n\n1. Interrupt 10 Spot instances filtering by instance tags, with parameters **--tag-key** and **--tag-value**\n\n```bash\nesi interrupt --duration-before-interruption 2 --count 10 --tag-key fis --tag-value yes\n```\n\n## Uninstall\n\n1. Using a terminal, change current directory to the downloaded repository folder.\n2. Run the uninstall script:\n\n```bash\nsudo bash uninstall.sh\n```\n\n3. Delete the repository folder.\n\nTip: You may have to manually remove the installation files if it persist.\n\n```bash\nsudo rm -rf /usr/local/bin/esi\n```\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis library is licensed under the MIT-0 License. See the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-samples%2Fec2-spot-interrupter-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws-samples%2Fec2-spot-interrupter-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-samples%2Fec2-spot-interrupter-cli/lists"}