Skip to content

Instantly share code, notes, and snippets.

@kob-aha
Created April 7, 2024 19:59
Show Gist options
  • Save kob-aha/9398e1341a1045c6c13151fce901c10a to your computer and use it in GitHub Desktop.
Save kob-aha/9398e1341a1045c6c13151fce901c10a to your computer and use it in GitHub Desktop.
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]\" }",
"maxDuration": "PT1M"
}
},
"S01_Wait": {
"actionId": "aws:fis:wait",
"parameters": {
"duration": "PT10M"
},
"startAfter": [
"S00_AttachExtensionToLambda"
]
},
"S02_DetachExtensionFromLambda": {
"actionId": "aws:ssm:start-automation-execution",
"description": "Attach chaos extension to lambda function",
"parameters": {
"documentArn": "[ARN of an SSM document similar to the one created above]",
"documentParameters": "{\"ChaosMode\": \"DISABLED\", \"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]\" }",
"maxDuration": "PT1M"
},
"startAfter": [
"S01_Wait"
]
},
},
"stopConditions": [
{
"source": "none"
}
],
"roleArn": "[ARN with permission to run an experiment]",
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment