Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

ec2-spot-interrupter-cli

A CLI tool to simulate EC2 Spot Instances interruptions using AWS Fault Injection Simulator (FIS).

Since 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.

Install (macOS, Linux)

  1. Use AWS CloudShell or your favorite terminal, clone this repository.
git clone https://github.com/aws-samples/ec2-spot-interrupter-cli.git
  1. Change current directory to the downloaded repository folder.
  2. Run the install script:
sudo bash install.sh

Getting started

To use this tool, you will need AWS credentials configured. Take a look at the AWS CLI configuration documentation for details on the various ways to configure credentials.

Populate the following environment variables with your AWS API credentials.

export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."

Set the AWS_REGION environment variable if it's not configured.

export AWS_REGION="..."

Synopsis

esi interrupt

-tk, --tag-key | Filter instances tag key [required]
-tv, --tag-value | Filter instances tag value [required]
[-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.
[-c, --count] | Number of instances to interrupt, between 1 and 1000. Default is 1.
[--confirm] | Flag to auto confirm interruption.
[-ir, --iam-role] | ARN of IAM role for FIS.
[--help] | Show help message.

Examples

  1. Interrupt 10 Spot instances filtering by instance tags, with parameters --tag-key and --tag-value
esi interrupt --duration-before-interruption 2 --count 10 --tag-key fis --tag-value yes

Uninstall

  1. Using a terminal, change current directory to the downloaded repository folder.
  2. Run the uninstall script:
sudo bash uninstall.sh
  1. Delete the repository folder.

Tip: You may have to manually remove the installation files if it persist.

sudo rm -rf /usr/local/bin/esi

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

A CLI tool to simulate EC2 Spot Instances interruptions using AWS Fault Injection Simulator.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published