Skip to main content

Quick EKS corss-AZ log

Project description

Quick EKS cross az

This script helps estimating cross az data transfer costs in EKS clusters.

The script is based on an existing AWS open solution. It simplifies operations by using your current AWS role directly from your shell session, and without using any iam:* permission...

Features

  • Runs With Your Current AWS Credentials: Uses the AWS credentials and settings you already have configured in your shell session. No need to configure special credentials just for the demo.
  • Works Without Administrator Privileges: No need for IAM modification permissions - it's designed to work seamlessly with PowerUser access.
  • Reuses Your EKS Authentication: Uses the active Kubernetes context in your shell to retrieve pod and node metadata.
  • Simple Exectuion: Offers one-line execution with pipx or docker for all orchestration including cleanup.

Technical Details

Similar to the original solution, this project utilizes CloudFormation to provision flow logs and S3 buckets. However, it orchestrates everything using a script:

  • Flow logs are temporarily enabled for the EKS VPC, and necessary S3 buckets are created via CloudFormation.
  • Pod metadata, including the app label and node IP, is gathered.
  • After a configurable timeframe, flow logs are aggregated within Athena.
  • The results are downloaded as a CSV file.
  • Finally, the script cleans up any infrastructure changes made.

Getting Started

Prerequisites

  • Python version 3.6 or later
  • Kubernetes Cluster API access in current shell
  • An active AWS role in your current shell that has permissions to:
    • Create flow logs
    • Create S3 buckets
    • Run Athena queries

Using Pipx

Easiest way to run the script is with pipx. Pipx lets you run Python packages quickly in isolation:

python3 -m pip install --user pipx # install pipx if required
python3 -m pipx run quick-eks-cross-az --help

Using Docker

docker run  -v ~/.kube/config:/kube/config -e KUBECONFIG=/kube/config -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN  asafamr123/quick-eks-cross-az --help

CLI

usage: cli.py [-h] [--minutes N] [--quiet | --no-quiet] [--verbose | --no-verbose]
              [--cleanup | --no-cleanup] [--output OUTPUT] [--stack-name STACK_NAME]

Quick EKS Cross AZ Log
--------
This script measures EKS cross AZ traffic using flow logs and data from active Kubernetes context.
Full docs are here: https://github.com/asafamr/quick-eks-cross-az 

options:
  -h, --help            show this help message and exit
  --minutes N           minutes of flow logs accumulation
  --quiet, --no-quiet   run without manual confirmation
  --verbose, --no-verbose
                        verbose log
  --cleanup, --no-cleanup
                        cleanup a previous interrupted run
  --output OUTPUT       output file name
  --stack-name STACK_NAME
                        override CloudFormation stack name

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quick_eks_cross_az-0.9.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quick_eks_cross_az-0.9.3-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file quick_eks_cross_az-0.9.3.tar.gz.

File metadata

  • Download URL: quick_eks_cross_az-0.9.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for quick_eks_cross_az-0.9.3.tar.gz
Algorithm Hash digest
SHA256 d690c7c5e35b5bf1076c6612f04ac67ad72f40c684fe160a160705aa53c0f482
MD5 75aa9ffe53de1355d2e624217f5236f1
BLAKE2b-256 e654be9d31f1624609965ef16293216f8596bad87de9a4f046d135b614826246

See more details on using hashes here.

File details

Details for the file quick_eks_cross_az-0.9.3-py3-none-any.whl.

File metadata

File hashes

Hashes for quick_eks_cross_az-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 214221e08ed7d38d5d5a32a8e3083e8cdbe96373a7b57a8bda74abf4f8b436b7
MD5 fa58e137ab999334e1c796f693496e3c
BLAKE2b-256 97e05b306cfdc50108131419fbf4316eb9eaa9f435ceae4c40f02d6a3d28408b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page