Introducing a new way to review your PRs.

Read the announcement

floci-io / floci

Light, fluffy, and always free - The AWS Local Emulator alternative

View on GitHub

38 documents · Updated Nov 23, 2026

docs / svc-access-analyzer

Access Analyzer

Access Analyzer provides an AWS-compatible resource lifecycle for policy analysis. It lets a caller create named analyzers for an account and Region, inspect their current analysis state, and remove them when they are no longer needed.

Analyzer resources

Analyzer identity

An analyzer is the account-owned object that defines a policy analysis scope. Its identity includes a name, type, ARN, status, creation time, tags, and optional configuration. The current service creates each analyzer in ACTIVE state and returns this metadata when it lists or gets analyzers.

The supported analyzer types cover account and organization analysis for external access, unused access, and internal access. The type determines the policy scope and the local quota that applies to the resource.

References: src/…/Analyzer.java• L12-19 src/…/AccessAnalyzerService.java• L26-32 src/…/AccessAnalyzerController.java• L88-99

Account and Region scope

Analyzer state belongs to the caller's AWS account and the request Region. The service keeps the same analyzer name separate when those scopes differ, so a list, get, or delete operation sees only analyzers in the resolved account and Region. This account boundary is part of the wider identity model described in IAM and authentication.

The service persists analyzer state through account-aware storage. A reset clears the stored analyzer set, which gives local workflows a clean policy-analysis state.

References: src/…/AccessAnalyzerService.java• L34-41 src/…/AccessAnalyzerService.java• L77-89 src/…/AccessAnalyzerService.java• L100-103 src/…/AccountAwareStorageBackend.java• L17-30

Analyzer lifecycle

Lifecycle operations

The lifecycle starts when a caller creates an analyzer. The service checks its identity and type, assigns an ARN and active state, and stores the resource. A caller can then list or inspect analyzers in the same account and Region or delete one by name.

The following diagram shows how the controller passes a request through Region scoping and resource state changes.

flowchart LR
    A[Create request] --> B[Resolve account and Region]
    B --> C[Validate name and type]
    C --> D[Apply type quota]
    D --> E[Store ACTIVE analyzer]
    E --> F[List or get analyzer metadata]
    F --> G[Delete by name]
    G --> H[Analyzer removed]

A create request returns the analyzer ARN. A list request returns analyzer summaries and can filter by type. A get request returns one analyzer summary. A delete request returns an empty success object after the resource is removed.

References: src/…/AccessAnalyzerController.java• L44-86 src/…/AccessAnalyzerService.java• L44-89 src/…/AccessAnalyzerIntegrationTest.java• L20-30

Analyzer quotas

The service limits the number of analyzers by exact type within a Region. Account-scoped types and organization internal-access analyzers allow one resource each. Organization external-access and organization unused-access types allow five each. Different types use separate limits.

These limits model local resource state. They do not represent findings or a live AWS service quota account.

References: src/…/AccessAnalyzerService.java• L53-58 src/…/AccessAnalyzerService.java• L91-97 src/…/AccessAnalyzerIntegrationTest.java• L32-57

AWS-compatible service surface

REST JSON operations

Access Analyzer exposes a REST JSON controller at the service root. The controller resolves the request Region, accepts JSON for create, and maps analyzer state into AWS-style response fields. Request routing and protocol behavior are shared with the wider service surface described in request routing and protocols.

OperationMethod and pathPurpose
ListAnalyzersGET /analyzerReturn analyzers in the account and Region. Supports type, maxResults, and nextToken.
CreateAnalyzerPUT /analyzerCreate an analyzer from analyzerName, type, optional tags, and optional configuration.
GetAnalyzerGET /analyzer/{analyzerName}Return one analyzer in the account and Region.
DeleteAnalyzerDELETE /analyzer/{analyzerName}Remove the named analyzer from the account and Region.

Listing is paginated. The response uses analyzers for the resource summaries and includes nextToken when more results remain. A get response places one summary under analyzer.

References: src/…/AccessAnalyzerController.java• L28-86 src/…/AccessAnalyzerController.java• L88-99 src/…/AccessAnalyzerService.java• L77-84 src/…/AccessAnalyzerService.java• L157-166

Policy-analysis state

The exposed analysis state is the analyzer resource state, not a findings stream. The controller reports the analyzer's type, ACTIVE status, ARN, creation time, tags, and optional configuration so a client can track which analysis scope exists through list or get operations.

The implemented surface does not add operations for findings, archive rules, or analyzer updates. Clients must delete and recreate an analyzer when they need a different resource definition.

References: src/…/AccessAnalyzerService.java• L60-73 src/…/AccessAnalyzerService.java• L157-166 src/…/AccessAnalyzerController.java• L78-99

Request validation

Resource input rules

Create requests must provide a valid analyzer name and one of the supported types. Names start with a letter and can contain letters, digits, periods, hyphens, and underscores. The same name rules apply when a caller gets or deletes an analyzer. Optional tags use string values and cannot use the reserved aws: prefix. Optional configuration must be a JSON object.

The controller rejects malformed JSON, including JSON with trailing content. These checks keep invalid policy-analysis state out of persistent storage before the service applies quotas.

References: src/…/AccessAnalyzerService.java• L105-161 src/…/AccessAnalyzerController.java• L102-111 src/…/AccessAnalyzerIntegrationTest.java• L59-71

Service errors

The service returns AWS-style errors for conditions that follow from the request or local analyzer state.

TriggerErrorMeaning
Invalid name, type, tags, configuration, pagination, or JSONValidationException or SerializationExceptionThe request cannot define a valid analyzer operation.
Existing name in the same account and RegionConflictExceptionThe analyzer identity is already in use.
Valid but unknown name on get or deleteResourceNotFoundExceptionNo analyzer exists in the selected scope.
Type quota reachedServiceQuotaExceededExceptionThe selected analyzer type cannot add another resource in that Region.

Provider-side failures such as access denial, throttling, and internal service faults are not injected unless local request or emulator state can derive them.

References: src/…/AccessAnalyzerService.java• L47-57 src/…/AccessAnalyzerService.java• L86-89 src/…/AccessAnalyzerService.java• L157-174 docs/…/access-analyzer.md• L21-25

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the controller paths, response field names, and generated action list aligned when an operation changes.
  • Keep analyzer type names and their exact-type quota rules aligned across validation, creation, listing, and deletion.
  • Preserve account and Region scoping when changing storage keys or Region resolution. A scope change can expose or hide existing analyzer state.
  • Keep pagination inputs and nextToken output aligned with the list ordering when analyzer identity rules change.
  • Keep get and delete lookup behavior aligned so both operations use the same name validation and account-Region scope.

Important failure modes

TriggerConsequenceGuard
A second analyzer of a limited type is created in one account and RegionCreation returns ServiceQuotaExceededExceptionApply the quota to the exact analyzer type before storage.
A caller lists, gets, or deletes with a different RegionThe caller cannot see the analyzer created in the original RegionResolve the Region from each request and keep all lifecycle operations on the same scope.
A create body contains valid JSON followed by extra JSONThe request returns SerializationException and stores nothingReject trailing JSON before the service receives the request.
A get or delete names an analyzer outside the caller's accountThe operation returns ResourceNotFoundExceptionKeep analyzer lookup account-aware.

Key files

FileWhy to read it
src/…/AccessAnalyzerController.javaShows the REST JSON contract and the mapping between requests and analyzer summaries.
src/…/AccessAnalyzerService.javaDefines analyzer lifecycle, scope, validation, quotas, and service errors.
src/…/Analyzer.javaDefines the analyzer state exposed by list and get operations.
src/…/AccountAwareStorageBackend.javaExplains the account boundary used by persisted service state.
src/…/AccessAnalyzerIntegrationTest.javaDemonstrates the public lifecycle, quota behavior, and request error contract.