Documentation Index Fetch the complete documentation index at: https://kosli-mintlify-62433367.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
By the end of this tutorial, you will have reported a snapshot of your AWS environment to Kosli, making its running artifacts visible and trackable.
There are two ways to do this:
Kosli CLI — quick to run, suitable for testing only
Kosli reporter Terraform module — deploys a Lambda reporter for continuous, production-grade reporting
Follow the section that matches your needs.
Prerequisites
Report using Kosli CLI
This approach is suitable for testing only.
Install Kosli CLI if you have not done so, then export your AWS credentials:
export AWS_REGION = yourAWSRegion
export AWS_ACCESS_KEY_ID = yourAWSAccessKeyID
export AWS_SECRET_ACCESS_KEY = yourAWSSecretAccessKey
Run the snapshot command for your environment type:
kosli snapshot ecs aws-env-tutorial \
--cluster < your-ecs-cluster-nam e > \
--api-token < your-api-token-her e > \
--org < your-kosli-org-nam e >
kosli snapshot lambda aws-env-tutorial \
--function-names function1,function2 \
--api-token < your-api-token-her e > \
--org < your-kosli-org-nam e >
kosli snapshot s3 aws-env-tutorial \
--bucket < your-bucket-nam e > \
--api-token < your-api-token-her e > \
--org < your-kosli-org-nam e >
Install Terraform if you have not done so.
Authenticate to AWS .
Store your Kosli API token in AWS SSM Parameter Store as a SecureString parameter named kosli_api_token.
Create a main.tf file with the configuration for your environment type:
terraform {
required_version = " >= 1.0.0 "
required_providers {
aws = {
source = " hashicorp/aws "
version = " >= 4.63 "
}
random = {
source = " hashicorp/random "
version = " >= 3.5.1 "
}
}
}
provider "aws" {
region = local . region
# Make it faster by skipping some checks
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}
locals {
reporter_name = " reporter- ${ random_pet . this . id } "
region = " eu-central-1 "
}
data "aws_caller_identity" "current" {}
data "aws_canonical_user_id" "current" {}
resource "random_pet" "this" {
length = 2
}
module "lambda_reporter" {
source = " kosli-dev/kosli-reporter/aws "
version = " 0.5.7 "
name = local . reporter_name
kosli_environment_type = " ecs "
kosli_cli_version = " v2.11.0 "
kosli_environment_name = " aws-env-tutorial "
kosli_org = " <your-org-name> "
reported_aws_resource_name = " <your-ecs-cluster-name> "
}
terraform {
required_version = " >= 1.0.0 "
required_providers {
aws = {
source = " hashicorp/aws "
version = " >= 4.63 "
}
random = {
source = " hashicorp/random "
version = " >= 3.5.1 "
}
}
}
provider "aws" {
region = local . region
# Make it faster by skipping some checks
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}
locals {
reporter_name = " reporter- ${ random_pet . this . id } "
region = " eu-central-1 "
}
data "aws_caller_identity" "current" {}
data "aws_canonical_user_id" "current" {}
resource "random_pet" "this" {
length = 2
}
variable "my_lambda_functions" {
type = string
default = " function_name1, function_name2 "
}
module "lambda_reporter" {
source = " kosli-dev/kosli-reporter/aws "
version = " 0.5.7 "
name = local . reporter_name
kosli_environment_type = " lambda "
kosli_cli_version = " v2.11.0 "
kosli_environment_name = " aws-env-tutorial "
kosli_org = " <your-org-name> "
reported_aws_resource_name = var . my_lambda_functions
use_custom_eventbridge_pattern = true
custom_eventbridge_pattern = local . custom_event_pattern
}
locals {
lambda_function_names_list = split ( " , " , var . my_lambda_functions)
custom_event_pattern = jsonencode ({
source = [ " aws.lambda " ]
detail-type = [ " AWS API Call via CloudTrail " ]
detail = {
requestParameters = {
functionName = local.lambda_function_names_list
}
responseElements = {
functionName = local.lambda_function_names_list
}
}
})
}
terraform {
required_version = " >= 1.0.0 "
required_providers {
aws = {
source = " hashicorp/aws "
version = " >= 4.63 "
}
random = {
source = " hashicorp/random "
version = " >= 3.5.1 "
}
}
}
provider "aws" {
region = local . region
# Make it faster by skipping some checks
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}
locals {
reporter_name = " reporter- ${ random_pet . this . id } "
region = " eu-central-1 "
}
data "aws_caller_identity" "current" {}
data "aws_canonical_user_id" "current" {}
resource "random_pet" "this" {
length = 2
}
module "lambda_reporter" {
source = " kosli-dev/kosli-reporter/aws "
version = " 0.5.7 "
name = local . reporter_name
kosli_environment_type = " s3 "
kosli_cli_version = " v2.11.0 "
kosli_environment_name = " aws-env-tutorial "
kosli_org = " <your-org-name> "
reported_aws_resource_name = " <your-s3-bucket-name> "
}
Initialize and apply the Terraform configuration:
terraform init
terraform apply
To verify the Lambda reporter is running, go to the AWS console → Lambda → your reporter function → Monitor → Logs.
What you’ve accomplished
You have reported a snapshot of your AWS environment to Kosli. Kosli now tracks the running artifacts in that environment and will record changes as they happen.
From here you can: