Skip to content

Instantly share code, notes, and snippets.

@kob-aha
kob-aha / attach_chaos_extension_ssm_document_parameters.yaml
Last active April 13, 2024 06:46
SSM Document for attaching extension to a Lambda function and enable fault injection - Parameters Part
parameters:
FunctionName:
type: "String"
description: "The name of the lambda function to add the layer"
LayerArn:
type: "String"
description: "The ARN of the layer to add to the lambda function"
AliasName:
type: "String"
description: "(Optional) The name of the lambda alias needs to be updated."
@kob-aha
kob-aha / attach_chaos_extension_ssm_document_handler.yaml
Last active April 14, 2024 17:24
SSM Document for attaching extension to a Lambda function and enable fault injection - Handler function
def handler(event, context):
# Parse the input event to an internal class
config: DocumentConfig = DocumentConfig.from_event(event)
if config.chaos_mode == 'ENABLED':
enable_chaos(config)
else:
disable_chaos(config)
@kob-aha
kob-aha / lambda_fis_experiment.json
Created April 7, 2024 19:59
A Json file presenting a FIS template for injecting failures into a Lambda function
{
"description": "Inject Lambda failures using Lambda extension",
"targets": {},
"actions": {
"S00_AttachExtensionToLambda": {
"actionId": "aws:ssm:start-automation-execution",
"description": "Attach chaos extension to lambda function",
"parameters": {
"documentArn": "[ARN of the SSM document we created above]",
"documentParameters": "{\"AutomationAssumeRole\": \"[ARN of an IAM role with permissions to update a Lambda function]\" , \"FunctionName\": \"[The name of the function we want to inject failures to]\", \"LayerArn\": \"arn:aws:lambda:us-east-1:871265522301:layer:chaos-lambda-extension-x86_64-unknown-linux-gnu-release:12\", \"AliasName\": \"[The alias of the function we want to update]\" }",
@kob-aha
kob-aha / attach_chaos_extension_ssm_document.yaml
Last active April 14, 2024 17:24
SSM Document for attaching extension to a Lambda function and enable fault injection
schemaVersion: "0.3"
description: "Enable fault injection (Chaos) to a given lambda function by attaching a Lambda extension"
assumeRole: "{{ AutomationAssumeRole }}"
parameters:
FunctionName:
type: "String"
description: "The name of the lambda function to add the layer"
LayerArn:
type: "String"
description: "The ARN of the layer to add to the lambda function"
@kob-aha
kob-aha / approaches_comparison_table.md
Last active January 14, 2024 09:44
Chaos Engineering Blog - Table
Approach Pros Cons
@kob-aha
kob-aha / .gitignore
Created June 4, 2018 18:29 — forked from wouterd/Vagrantfile
Vagrant file to setup a 3-server mongo replica set and a script to intialize the mongod cluster
.vagrant/
@kob-aha
kob-aha / casperjs_gmailLoader_sample.js
Created April 29, 2016 18:37
CasperJS sample file for connecting to gmail and capturing main page
var casper = require('casper').create();
var system = require('system');
var username = [ENTER_EMAIL_HERE];
var userpass = [ENTER_PASSWORD_HERE];
function enterUsername(username) {
document.getElementById("Email").value=username;
document.getElementById("next").click();
}
@kob-aha
kob-aha / config.groovy
Last active January 2, 2016 00:49
Example of how to configure multiple keys in a property file with the same value
def configStr = '''
installer.dir="${installerDir()}"
dist.dir="${installerDir()}/Incubator"
def installerDir() {
'/home/test'
}
'''
def config = new ConfigSlurper().parse(configStr)