Skip to content

Open source Read-only, and boto3 is all it needs

AWS, explained in your notebook

You work in a SageMaker notebook, not the AWS console. aws-analyzer reads your buckets, tables, knowledge bases, notebooks, vector indexes and Lambda functions, and tells you what's there, what it costs, what's wrong, and the exact call to run next.

%pip install aws-analyzer

Start with your S3 buckets Pick a service

Works with Amazon S3 Amazon DynamoDB Bedrock Knowledge Bases Amazon SageMaker Amazon OpenSearch AWS Lambda AWS Step Functions Amazon API Gateway Amazon Athena SQS, SNS and EventBridge

Plain English

It reads AWS so you don't have to

The console and the API hand you JSON, log lines and metrics. aws-analyzer turns them into sentences that say what it means for you, put a price on it, and name the next step. These are lines from its reports.

What AWS gives you
What aws-analyzer says
{
  "Sid": "PartnerRead",
  "Effect": "Allow",
  "Principal": {"AWS": "arn:aws:iam::210987654321:root"},
  "Action": ["s3:GetObject", "s3:ListBucket"],
  "Resource": ["arn:aws:s3:::acme-ml-data",
               "arn:aws:s3:::acme-ml-data/curated/*"]
}

Statement PartnerRead gives other AWS accounts access (210987654321): read files, list files.

Who account 210987654321
Can read files, list files
On bucket acme-ml-data, s3://acme-ml-data/curated/*

From bucket_info() in the S3 guide. policy() shows every statement this way, and its JSON.

[ERROR] ClientError: An error occurred (AccessDeniedException)
when calling the PutItem operation: User: arn:aws:sts::123456789012:
assumed-role/acme-lambda-role/orders-etl is not authorized to perform:
dynamodb:PutItem on resource: arn:aws:dynamodb:us-east-1:
123456789012:table/orders

Its code was refused access twice (the last 6h ago): its role acme-lambda-role isn't allowed dynamodb:PutItem on arn:aws:dynamodb:us-east-1:123456789012:table/orders. Add the permission to the role's policy in IAM.

From errors('orders-etl') in the Lambda guide, which groups a function's errors by cause and links each to the run that shows it.

{"pk": {"S": "USER#0"}, "sk": {"S": "ORDER#0000"},
 "status": {"S": "shipped"}, "total": {"N": "69.83"},
 "lines": {"L": [{"M": {"sku": {"S": "SKU-046"},
                         "qty": {"N": "1"}}}]}}
pk (partition key) USER#0
status shipped
total 69.83
lines 1 element
sku SKU-046

From get('orders', 'USER#0', 'ORDER#0000') in the DynamoDB guide, with what that read cost: 1 read unit.

Every guide

Start from the question you have

Each guide sets you up in SageMaker, walks through every command with real output, and lists the IAM permissions it needs.

One pattern

Every report reads the same way

Learn one and you can read them all. Each report puts the answer first and ends with what to do about it.

  1. The answer Cards with the few numbers that matter, in units you know: sizes, dollars a month, how long ago. A card turns amber when a warning below is about it.
  2. What needs a look Findings, warnings first. Each one says what's wrong, why it matters, what it costs, and what to change.
  3. The detail Tables you can sort, filter and trim, and the raw JSON folded away for when you want it.
  4. What to run next Two or three numbered calls with the arguments already filled in, written as your notebook runs them (ui.errors('orders-etl')). ui.next(1) runs the first; ui.next() puts them all in a cell below.

overview(): a table of four buckets with objects, size, estimated monthly cost, versioning, encryption and public access, and a list of warnings overview(): a table of four buckets with objects, size, estimated monthly cost, versioning, encryption and public access, and a list of warnings

ui.overview() in the S3 guide: every bucket, what it costs, and what needs a look.

Every service starts the same way. It uses the notebook's IAM role, so there's nothing to configure:

from aws_analyzer import S3View  # or DynamoDBView, BedrockKBView, SageMakerView, OpenSearchView, LambdaView

ui = S3View()              # uses the notebook's IAM role
ui.help()                  # every command, grouped by task; ui.help("name") shows one in full
s3 = ui.core               # the analyzer behind the view: returns data instead of a report

Promises

What it will never do

Change anything in your account

It only reads. When a finding suggests a fix, it shows you the command and leaves running it to you.

Ask you to set it up

It uses the notebook's IAM role and region. A missing permission becomes a note naming it, and the rest of the report still shows.

Need more than boto3

SageMaker already has it. pandas, file readers and widgets are used when they're there, and a report says what to install when one is missing.

Pretend an estimate is a bill

Costs say which prices they used, partial results say where they stopped, and long scans stop early unless you ask for more.

Time zones

Times in your time zone

Times are in UTC until you pick a zone. Then every report and window, for every service, shows its times in your zone and says which one (Last modified (IST), since 2024-05-01 14:02 IST), and dates you type in (since="2024-05-01 10:00") are read there too:

from aws_analyzer import set_timezone

set_timezone("Asia/Kolkata")   # or its city, "kolkata"; "America/New_York", "+05:30", "UTC" to go back

set_timezone("local") uses the machine's own zone, which on SageMaker is UTC, so name yours there. The AWS_ANALYZER_TZ environment variable picks the zone for every notebook (AWS_ANALYZER_TZ=Asia/Kolkata). CloudWatch's daily numbers stay in UTC days, since that's how AWS adds them up, and their columns say so (Day (UTC)).

Themes

Pick how reports look

Reports come in five themes, each made for a light or a dark notebook. console is the default. Pick another and every report from then on uses it, while the ones already in the notebook keep theirs:

from aws_analyzer import set_theme

set_theme("soft")   # "console", "soft", "editorial", "brand" or "classic"; None goes back to the default

The top of a Lambda function's report in the console theme: its title, the cards with its numbers and its findings The top of a Lambda function's report in the console theme: its title, the cards with its numbers and its findings

The default: boxed panels, WARN and INFO tags, and numbers in a monospace font. Dense, like the AWS console. set_theme("console")

The top of a Lambda function's report in the soft theme: its title, the cards with its numbers and its findings The top of a Lambda function's report in the soft theme: its title, the cards with its numbers and its findings

Rounded tiles on a light fill, small capitals over the numbers and columns, and the calls to run next as tiles. set_theme("soft")

The top of a Lambda function's report in the editorial theme: its title, the cards with its numbers and its findings The top of a Lambda function's report in the editorial theme: its title, the cards with its numbers and its findings

Almost no boxes: a serif title, the numbers as a row of large figures, and findings as a list. set_theme("editorial")

The top of a Lambda function's report in the brand theme: its title, the cards with its numbers and its findings The top of a Lambda function's report in the brand theme: its title, the cards with its numbers and its findings

This site's look: navy and indigo, white cards with soft shadows, and an amber highlighter on what needs a look. set_theme("brand")

The top of a Lambda function's report in the classic theme: its title, the cards with its numbers and its findings The top of a Lambda function's report in the classic theme: its title, the cards with its numbers and its findings

The look before themes: thin borders and tinted boxes. set_theme("classic")

The AWS_ANALYZER_THEME environment variable picks the theme for every notebook (AWS_ANALYZER_THEME=editorial). The explorer windows draw their reports in the theme too (the one set when the window opens). The chat windows keep their own look, and text output reads the same in every theme.

Your first report is one line away

Install it in a notebook cell, make a view, and ask. Nothing to set up, and nothing in your account changes.

%pip install aws-analyzer

Start with your S3 buckets See which Lambda failed