Lesson 046 · AWS Learning Path

AWS 046: Least privilege and access analysis

· Published · 7 min read

An access-analysis lens helps trim an oversized permission key to only the actions a workload uses

The problem

A team uses Least privilege and access analysis as a label or Console setting without proving the identity, scope, behavior, failure boundary, cost, or operational result. The configuration appears complete but the real requirement remains untested.

Final outcome

The learner will inspect, explain, test, and document Least privilege and access analysis. The submission must connect the Console and CLI view to the same AWS control, state what the evidence proves, diagnose one likely failure, and make a requirement-based architecture decision.

Learning outcomes

You will be able to:

  1. explain least privilege is a lifecycle;
  2. explain access analyzer has several jobs;
  3. explain external access uses a zone of trust;
  4. explain policy generation uses activity evidence;
  5. explain last accessed is not complete intent;
  1. distinguish successful configuration from successful workload behavior;
  2. preserve redacted evidence and complete the stated cleanup or retention decision.

Mental model

requirement
   -> identity and permission
   -> account, Region, and resource scope
   -> configuration or request
   -> observable state
   -> workload result
   -> failure evidence
   -> cleanup or controlled retention

Never begin with a create button or a copied command. Start with the result that must be proven and the boundary that must remain protected.

Core facts

ConceptWhat it means in practice
Least privilege is a lifecycleStart with the permissions required for known tasks, observe real use, remove unused actions and resources, and repeat as applications and responsibilities change.
Access Analyzer has several jobsIt can identify external access, selected internal access paths, and unused access. It also validates policy syntax and security practices and can generate policy templates from activity.
External access uses a zone of trustAn account or organization defines what is trusted. A finding means a resource policy permits access outside that zone, not proof that the outside principal actually used it.
Policy generation uses activity evidenceAccess Analyzer can analyze CloudTrail and service last-accessed information. Generated policy output requires review because not every data event, action, or future code path is represented.
Last accessed is not complete intentAn unused permission might be reserved for disaster recovery or a rare operation. A recently used action can still be too broad in resource or condition scope.
Validation is pre-deployment controlAccess Analyzer policy checks report errors, security warnings, general warnings, and suggestions so defective JSON or risky patterns can be corrected before release.

How to reason about it

A sound reduction workflow is collect, analyze, test, deploy, and monitor. Capture a representative business cycle, include incident and recovery paths, generate or draft a narrower policy, validate it, test it in a lower environment, deploy gradually, and watch authorization failures.

Access Analyzer policy generation does not include iam:PassRole because that permission is not tracked as a CloudTrail API call, and it does not identify action-level activity from data events such as S3 object data events. Treat generated output as evidence, not a complete final policy.

Use the following decision table as a starting point, then change the answer when the scenario changes.

RequirementPreferred directionWhy
Find public or cross-organization resource sharingExternal access analyzerIt reasons over supported resource policies against the chosen zone of trust.
Find dormant roles and unused permissionsUnused access analyzerIt evaluates last-accessed information over the configured window.
Build a smaller policy from observed callsPolicy generation plus manual reviewActivity provides a useful starting point but not complete future intent.
Check a policy in CI before deploymentAccess Analyzer ValidatePolicy APIAutomated findings catch syntax and many security issues early.

Prerequisites, permissions, Region, and cost

Run this lesson as the approved non-root course identity. Begin with aws sts get-caller-identity, confirm the private account record, and set the fixed project Region before any regional query. IAM resources are global within an account, while STS endpoints and the services reached by an identity can be regional.

Use only the read or change actions required for this lesson. An AccessDenied result is evidence to analyse, not permission to switch to root or attach AdministratorAccess. Record the action, resource, principal type, request context, and smallest justified correction.

The listed cost tier is T0 - no resource creation. Free Tier eligibility and credits are account-specific. Before a mutating lab, identify every resource that can charge, estimate its duration, start a timer, and write the reverse cleanup order. A budget reports cost after billing data arrives and is not a real-time stop control.

AWS Management Console method

  1. Open IAM Access Analyzer and choose Analyzers.
  2. Inspect external-access and unused-access findings, then open one finding to see the policy path and archive rule options.
  3. Open Policy validation or Generate policy for a test role and review the output before applying any permission change.

For every step record the service page, selected account and Region, exact object, visible state, and why that state matters. A Console label or green status is not enough unless it is tied to the final workload outcome.

AWS CLI or API evidence

Validate a local identity-policy document before attaching it.

aws accessanalyzer validate-policy --policy-document file://policy.json --policy-type IDENTITY_POLICY --query 'findings[].{Type:findingType,Issue:issueCode,Detail:findingDetails}' --output table

Resolve errors first, then review security warnings, warnings, and suggestions. A clean validation result does not prove the policy is least privilege for the business purpose.

Before running the command, replace every placeholder, explain each option, and decide whether the operation is read-only or mutating. Capture the exit code immediately. Redact account IDs, ARNs, public addresses, request identifiers, and personal data before sharing.

The CLI and Console are clients of AWS APIs. Matching state across them increases confidence, but neither substitutes for data-plane or application verification.

Practical work

Create least-privilege-and-access-analysis-evidence.md. Record the problem, account and Region preflight, observed Console state, matching CLI result, every decision in the table, one intentional misconception, one failure diagnosis, and the retained-state or cleanup result.

The evidence package must include:

  • non-root principal type, account verified privately, and Region;
  • exact intended and observed state;
  • one Console observation and the matching CLI or API result;
  • one successful result and one denied, failed, or counterexample result;
  • what each result does not prove;
  • cost state and elapsed lab time;
  • cleanup evidence or a named retained-state owner and next lesson.

Verification standard

Use three levels of proof:

  1. Control plane: the object or policy exists with the intended configuration.
  2. Data plane or behavior: the request, packet, session, storage path, or application does what the requirement states.
  3. Operations: monitoring, failure diagnosis, cost, ownership, and cleanup are known.

A control-plane response can precede final readiness. Use waiters or state polling where supported, then test the actual behavior. If a request times out, do not assume it failed. Inspect state and use documented idempotency before retrying a mutation.

Troubleshooting method

SymptomEvidence firstSmallest safe response
command cannot authenticatecredential source, expiry, caller preflightrestore approved temporary login
access is deniedaction, resource, principal, all policy layerscorrect only the missing or conflicting control
object appears missingaccount, Region, filters, pagination, permissionalign scope before creating anything
configured state exists but behavior failsroute, identity, dependency, logs, service statetest the next boundary in the path
cleanup is blockeddependency inventory and owning serviceremove dependants in reviewed reverse order

Keep the original symptom and timestamp. State one hypothesis, make one reversible change, repeat the original test, and record rollback. Never open a management port to the world, expose credentials, disable TLS verification, format an unknown disk, or add broad permissions as a generic fix.

Architecture and certification decisions

Professional-level questions provide competing valid features. Identify the requirement that decides between them: human or workload identity, same-account or cross-account access, regional or zonal scope, stateful or stateless filtering, durable or ephemeral data, latency, RTO/RPO, cost, or operational ownership.

Explain why the selected option fits and why each plausible alternative fails one stated requirement. Do not rely on feature memorization or reproduce protected certification questions.

Knowledge check

  1. Does an external-access finding prove data was accessed?

Expected direction: No. It proves that a supported policy creates a possible access path outside the zone of trust. Use logs to investigate actual use.

  1. Can generated policy output be attached without review?

Expected direction: No. Rare paths, data events, PassRole, unsupported detail, and future behavior can be missing.

  1. Is a permission safe merely because it was used yesterday?

Expected direction: No. The action might still cover excessive resources or lack necessary conditions.

  1. What should follow a permissions reduction?

Expected direction: Functional and recovery testing plus monitoring for denied operations.

Cost, cleanup, and retained state

No workload resource should remain unless this lesson explicitly creates and retains one for the next numbered lab.

Cleanup evidence includes the final state query, not only a successful delete response. Search related resources, other Regions used by the lab, retained storage, public IPv4 addresses, logging destinations, and service-managed dependencies. Schedule a later billing review because cost data can lag.

Completion gate

Pass when the practical artifact explains the real problem, matches Console and CLI evidence, answers every knowledge check, diagnoses one failure without broadening access, records cost, and proves cleanup or approved retention. The learner must defend one decision orally and name the requirement that would change it.

Official sources

Advertisement