Configure Execution Environment
Failure injection is a means of testing resiliency by which a specific failure type is simulated on a service and its response is assessed.
You have a choice of environments from which to execute the failure injections for this lab. Bash scripts are a good choice and can be used from a Linux command line. If you prefer Python, Java, Powershell, or C#, then instructions for these are also provided.
2.1 Setup AWS credentials and configuration
Your execution environment needs to be configured to enable access to the AWS account you are using for the workshop. This includes
Note: us-east-2 is the Ohio region
If you already know how to configure these, please do so now. If you need help or if you are planning to use PowerShell for this lab, then follow these instructions
2.2 Set up the bash environment
Click here for instructions if using bash:
Using bash is an effective way to execute the failure injection tests for this workshop. The bash scripts make use of the AWS CLI. If you will be using bash, then follow the directions in this section. If you cannot use bash, then skip to the next section
.
Prerequisites
awscli
AWS CLI installed
$ aws --version
aws-cli/1.16.249 Python/3.6.8...
jq
command-line JSON processor installed.
$ jq --version
jq-1.5-1-a5b5cbe
Download the resiliency bash scripts from GitHub
to a location convenient for you to execute them. You can use the following links to download the scripts:
Set the scripts to be executable.
chmod u+x fail_instance.sh
chmod u+x failover_rds.sh
chmod u+x fail_az.sh
2.3 Set up the programming language environment (for Python, Java, C#, or PowerShell)
Choose the appropriate section below for your language
Click here for instructions if using Java:
The command line utility in Java requires Java 8 SE.
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
If you have java 1.7 installed (as will be the case for In Amazon Linux), you need to install Java 8 and remove Java 7.
For Amazon Linux and RedHat
$ sudo yum install java-1.8.0-openjdk
$ sudo yum remove java-1.7.0-openjdk
For Debian, Ubuntu
$ sudo apt install openjdk-8-jdk
$ sudo apt install openjdk-7-jdk
Next choose one of the following options: Option A or Option B.
Option A: If you are comfortable with git
Clone the aws-well-architected-labs repo
$ git clone https://github.com/awslabs/aws-well-architected-labs.git
Cloning into 'aws-well-architected-labs'...
...
Checking out files: 100% (1935/1935), done.
go to the build directory
cd aws-well-architected-labs/Reliability/300_Testing_for_Resiliency_of_EC2_RDS_and_S3/Code/FailureSimulations/java/appresiliency
Option B:
- Download the zipfile of the executables at the following URL https://s3.us-east-2.amazonaws.com/aws-well-architected-labs-ohio/Reliability/javaresiliency.zip
- go to the build directory:
cd java/appresiliency
Build: mvn clean package shade:shade
cd target
- this is where your jar
files were built and where you can run from the command line