Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b9b0eb1

Browse files
committed
improve the readme to reflect the latest changes
1 parent 1765fd3 commit b9b0eb1

File tree

1 file changed

+52
-17
lines changed

1 file changed

+52
-17
lines changed

‎README.md‎

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@
33

44
* See the full blog post describing how to install and use this small chaos library [here](https://medium.com/@adhorn/injecting-chaos-to-aws-lambda-functions-using-lambda-layers-2963f996e0ba).
55

6-
### Changes by Gunnar Grosch
7-
Some changes made to be able to control injection per function instead of for all functions.
8-
9-
* Each function with the layer attached must have an environment variable named FAILURE_INJECTION_PARAM and containing the name of a parameter in Parameter Store.
10-
11-
* The layer can be easily installed using the serverless.yml template file using Serverless Framework: sls deploy
12-
13-
### Building the zip package on a MAC (easy on Linux)
14-
* Regardless if you are using Linux, Mac or Windows, the simplest way to create your ZIP package for Lambda Layer is to use Docker. If you don't use Docker but instead build your package directly in your local environment, you might see an ```invalid ELF header``` error while testing your Lambda function. That's because AWS Lambda needs Linux compatible versions of libraries to execute properly.
15-
16-
* That's where Docker comes in handy. With Docker you can very easily run a Linux container locally on your Mac, Windows and Linux computer, install the Python libraries within the container so they're automatically in the right Linux format, and ZIP up the files ready to upload to AWS. You'll need Docker installed first. (https://www.docker.com/products/docker).
17-
6+
### Features
7+
* Support for Latency injection using ```delay```
8+
* Support for Exception injection using ```exception_msg```
9+
* Support for HTTP Error status code injection using ```error_code```
10+
* Using for SSM Parameter Store to control the experiment using ```isEnable```
11+
* Per Lambda function injection control using Environment variable (```FAILURE_INJECTION_PARAM```) (thanks to Gunnar Grosh)
12+
* Support for Serverless Framework using ```sls deploy``` (thanks to Gunnar Grosh)
13+
14+
### Parameter Store Object
15+
```json
16+
{
17+
"delay": 200,
18+
"isEnabled": true,
19+
"error_code": 404,
20+
"exception_msg": "I FAILED"
21+
}
22+
```
23+
Deploy the chaos config in paramater store.
24+
* run the following command:
25+
```
26+
$ aws ssm put-parameter --region eu-north-1 --name chaoslambda.config --type String --overwrite --value "{ \"delay\": 400, \"isEnabled\": true, \"error_code\": 404, \"exception_msg\": \"I really failed seriously\" }"
27+
```
28+
29+
### Building and deploying
1830
1931
1. Clone the small chaos experiment library
2032
* run the following command:
@@ -23,7 +35,13 @@ Some changes made to be able to control injection per function instead of for al
2335
git clone git@github.com:adhorn/LatencyInjectionLayer.git
2436
```
2537
26-
2. Spin-up a docker-lambda container, and install all the Python requirements in a directory call .vendor
38+
39+
40+
2. Build the package manually (skip to step 4 if you want to use the serverless framework)
41+
42+
Regardless if you are using Linux, Mac or Windows, the simplest way to create your ZIP package for Lambda Layer is to use Docker. If you don't use Docker but instead build your package directly in your local environment, you might see an ```invalid ELF header``` error while testing your Lambda function. That's because AWS Lambda needs Linux compatible versions of libraries to execute properly. That's where Docker comes in handy. With Docker you can very easily run a Linux container locally on your Mac, Windows and Linux computer, install the Python libraries within the container so they're automatically in the right Linux format, and ZIP up the files ready to upload to AWS. You'll need Docker installed first. (https://www.docker.com/products/docker).
43+
44+
- Spin-up a docker-lambda container, and install all the Python requirements in a directory call .vendor
2745
* run the following command:
2846
2947
```
@@ -33,17 +51,34 @@ Some changes made to be able to control injection per function instead of for al
3351
* The -v flag makes the local directory available inside the container in the directory called working. You should now be inside the container with a shell prompt.
3452
3553
36-
3. Package your code.
54+
3. Package your code
3755
* run the following commands:
3856
```
3957
$ zip -r chaos_lib.zip ./python
4058
```
4159
42-
Voila! Your package file chaos_lib.zip is ready to be used in Lambda Layer.
60+
Voila! Your package file chaos_lib.zip is ready to be used in Lambda Layer.
4361
44-
4. Deploy the chaos config in paramater store.
62+
4. Deploy with Serverless framework
4563
* run the following command:
4664
```
47-
$ aws ssm put-parameter --region eu-north-1 --name chaoslambda.config --type String --overwrite --value "{ \"delay\": 400, \"isEnabled\": true, \"error_code\": 404, \"exception_msg\": \"I really failed seriously\" }"
65+
sls deploy
4866
```
4967
68+
5. Use the (python) method decorators to inject the failure to functions (either the whole Lambda handler or any other functions).
69+
* For latency injection, use
70+
```python
71+
@corrupt_delay
72+
```
73+
* For exception injection, use
74+
```python
75+
@corrupt_exception
76+
```
77+
78+
* For HTTP error status code injection, use
79+
```python
80+
@corrupt_statuscode
81+
```
82+
83+
84+
## Happy breaking!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /