This tutorial will walkthrough how to install Gremlin on Amazon Linux and perform a Chaos Engineering experiment using a Gremlin CPU attack.
Before you begin this tutorial, you'll need the following:
First open AWS console, click to launch an instance and select Amazon Linux 2 as your AMI:
When your instance starts click on “Connect” to identify how to connect via SSH to your new instance:
Your connection string will look similar to the following, paste this string into terminal and connect to your instance:
$ ssh -i "chaoseu.pem" firstname.lastname@example.org
Once you have successfully connected, you will see output on your terminal similar to the following:
__| __|_ ) _| ( / Amazon Linux 2 AMI ___|\___|___|https://aws.amazon.com/amazon-linux-2/
When using Amazon Linux 2 you will first need to install iproute-tc, Amazon Linux 1 comes pre-installed with iproute-tc:
$ sudo yum install -y iproute-tc
Next, add the Gremlin repository:
$ sudo curl https://rpm.gremlin.com/gremlin.repo -o /etc/yum.repos.d/gremlin.repo
Then install the Gremlin daemon and CLI:
$ sudo yum install -y gremlin gremlind
After you have created your Gremlin account (sign up here) you will need to find your Gremlin Daemon credentials. Login to the Gremlin App using your Company name and sign-on credentials. These were emailed to you when you signed up to start using Gremlin.
Navigate to Team Settings and click on your Team. Make a note of your Gremlin Secret and Gremlin Team ID.
Then initialise Gremlin and follow the prompts:
$ sudo gremlin init
You are now ready to create attacks using the Gremlin App.
Login to the Gremlin App using your Company name and sign-on credentials. These details were emailed to you when you created your Gremlin account.
First choose your target by selecting the host you registered with Gremlin:
Next we will use the Gremlin App to create a CPU Attack. Choose the Resource Category and Select the CPU Attack:
Click Unleash Gremlin and the Gremlin Free CPU Attack will consume CPU resources on your host.
You can now view the Gremlin Free CPU Attack in Datadog:
On your server, run top to check the impact of the Gremlin Attack:
$ toptop - 20:32:02 up 12 min, 2 users, load average: 0.19, 0.18, 0.09Tasks: 88 total, 1 running, 51 sleeping, 0 stopped, 0 zombie%Cpu(s): 66.2 us, 33.8 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stKiB Mem : 1007260 total, 627404 free, 56836 used, 323020 buff/cacheKiB Swap: 0 total, 0 free, 0 used. 794248 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4367 gremlin 20 0 16848 8784 6180 S 98.7 0.9 0:06.54 gremlin 3621 gremlin 20 0 11496 8208 5640 S 1.3 0.8 0:01.67 gremlind 1 root 20 0 125628 5544 4100 S 0.0 0.6 0:01.38 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H 5 root 20 0 0 0 0 I 0.0 0.0 0:00.01 kworker/u30:0 6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq 7 root 20 0 0 0 0 S 0.0 0.0 0:00.05 ksoftirqd/0 8 root 20 0 0 0 0 I 0.0 0.0 0:00.16 rcu_sched 9 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_bh 10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
When your attack is complete it will move to Completed Attacks.
You can stop a Gremlin Attack at anytime using the Gremlin App. Navigate to Gremlin Attacks and click on the halt button.
You've installed Gremlin on an instance running Amazon Linux 2 and validated that Gremlin works by running the Hello World of Chaos Engineering, the CPU Resource attack. You now possess tools that make it possible for you to explore additional Gremlin Attacks including attacks that impact State and Network.
Gremlin's Developer Guide is a great resource and reference for using Gremlin to do Chaos Engineering. You can start practicing Chaos Engineering today using Gremlin Free.
Gremlin empowers you to proactively root out failure before it causes downtime. See how you can harness chaos to build resilient systems by requesting a demo of Gremlin.Request a Demo