Crates.io | caws |
lib.rs | caws |
version | 0.1.8 |
source | src |
created_at | 2022-12-30 19:56:39.286929 |
updated_at | 2023-01-24 14:38:57.656911 |
description | Chaos on AWS Library |
homepage | |
repository | https://github.com/dawsonfi/caws |
max_upload_size | |
id | 748047 |
size | 58,589 |
Chaos on AWS Library and Lambda
cargo new --bin PROJECT_NAME
Cargo.toml
:[dependencies]
tokio = { version = "1.23.0", features = ["full"] }
serde_json = "1.0.91"
lambda_runtime = "0.7.2"
caws = "1.0.0"
main.rs
to the following code:use caws::{DestructionResults, Key, Kraken};
use lambda_runtime::{service_fn, Error, LambdaEvent};
use serde_json::{from_value, to_value, Value};
#[tokio::main]
async fn main() -> Result<(), Error> {
lambda_runtime::run(service_fn(func)).await?;
Ok(())
}
async fn func(event: LambdaEvent<Value>) -> Result<Value, Error> {
let event = event.payload;
let key: Key = from_value(event)?;
let kraken = Kraken::new();
let destruction_results = kraken.release(key).await?;
Ok(to_value(DestructionResults {
execution_status: destruction_results.execution_status,
})?)
}
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"]
}
]
})