Chaos on AWS Library and Lambda
cargo new --bin PROJECT_NAME
Add the necessary dependencies to you Cargo.toml
:
[dependencies]
tokio = { version = "1.23.0", features = ["full"] }
serde_json = "1.0.91"
lambda_runtime = "0.7.2"
caws = "1.0.0"
Change main.rs
to the following code:
``` use caws::{DestructionResults, Key, Kraken}; use lambdaruntime::{servicefn, Error, LambdaEvent}; use serdejson::{fromvalue, to_value, Value};
async fn main() -> Result<(), Error> { lambdaruntime::run(servicefn(func)).await?; Ok(()) }
async fn func(event: LambdaEvent
let kraken = Kraken::new();
let destruction_results = kraken.release(key).await?;
Ok(to_value(DestructionResults {
execution_status: destruction_results.execution_status,
})?)
}
``
* Build and package your code with:
cargo lambda build --release --x86-64 --output-format zip` (you might need to install cargo-lambda first)
"caws-constructs": "^0.1.4",
CawsLambda
construct:
import { CawsLambda } from 'caws-constructs';
new CawsLambda(this, 'lambda-id', {
functionName: 'function-name',
brazilPackagePath: 'path/to/bootstrap.zip',
env: [
"agents": {
//Configure here the agents that you want to enable
"test": ["dummy"]
}
]
})