# HKB-ReadOnly

Daily visibility (ViewOnlyAccess and SecurityAudit, plus the reads the verifier and change-set reviews need)

- **Session:** 8 hours. **Accounts:** [Management](/architecture/management/), [Log Archive](/architecture/log-archive/), [Security](/architecture/security/), [Shared Services](/architecture/shared-services/), [Dev](/architecture/dev/), [Prod](/architecture/prod/), [Sandbox](/architecture/sandbox/).
- **AWS managed policies:** `ViewOnlyAccess`, `SecurityAudit`.
- **Inline policy:** 46 actions across 15 services (access-analyzer, budgets, ce, cloudformation, codeconnections, codepipeline, controltower, ec2, imagebuilder, macie2, pricing, route53, scheduler, servicecatalog, ssm).
- **Source:** `bootstrap/hkb-bootstrap-identity.yaml`, resource `ReadOnlySet`.

## Policy

```yaml
ManagedPolicies:
  - arn:aws:iam::aws:policy/job-function/ViewOnlyAccess
  - arn:aws:iam::aws:policy/SecurityAudit
# Reads the two managed policies lack (DQ-19): landing zone state (INV-02), month-to-date
# spend (INV-08), change-set details for the review before every execute, budgets (S5-03)
# and policy validation before a PR (DQ-40).
InlinePolicy:
  Version: "2012-10-17"
  Statement:
    - Sid: VerifierReads
      Effect: Allow
      Action:
        - controltower:GetLandingZone
        - controltower:ListLandingZones
        - ce:GetCostAndUsage
        - ce:ListCostAllocationTags   # S4-05 (DQ-44, step 4.8)
        - cloudformation:DescribeChangeSet
        - cloudformation:ListChangeSets
        - budgets:ViewBudget
        - access-analyzer:ValidatePolicy
        # The VPC tier (S5-04, S5-05; step 5.5)
        - imagebuilder:GetImagePipeline
        - imagebuilder:GetImageRecipe
        - imagebuilder:GetComponent
        - imagebuilder:GetImage
        - imagebuilder:ListImagePipelines
        - imagebuilder:ListImagePipelineImages
        - imagebuilder:ListComponents
        - imagebuilder:ListImages
        - scheduler:ListSchedules
        - scheduler:GetSchedule
        - ssm:ListAssociations
        - ssm:DescribeAssociation
        - ssm:ListResourceComplianceSummaries
        - ssm:DescribeInstanceInformation
        # Account Factory products (S1-03), pipeline runs (S2-03), costs and prices for the
        # cost page and change reviews, and diagnosing a failed patch scan (DQ-129)
        - servicecatalog:ScanProvisionedProducts
        - servicecatalog:SearchProvisionedProducts
        - codepipeline:ListPipelineExecutions
        - codepipeline:ListActionExecutions
        - codeconnections:ListConnections
        - cloudformation:DescribeType
        - route53:TestDNSAnswer
        - ce:GetAnomalyMonitors
        - ce:GetDimensionValues
        - pricing:DescribeServices
        - pricing:GetProducts
        - pricing:GetAttributeValues
        - ssm:ListCommandInvocations
        - ssm:GetCommandInvocation
        - ec2:GetConsoleOutput
        # Macie's setup (S7-13, DQ-155): neither managed policy reads Macie. Never GetSensitiveDataOccurrences,
        # which returns samples of what Macie found
        - macie2:GetMacieSession
        - macie2:GetAdministratorAccount
        - macie2:ListOrganizationAdminAccounts
        - macie2:DescribeOrganizationConfiguration
        - macie2:GetAutomatedDiscoveryConfiguration
        - macie2:ListAutomatedDiscoveryAccounts
        - macie2:ListMembers
      Resource: "*"
    # The NAT AMI parameter only (S5-05); other parameters, such as the alert address, stay unread.
    - Sid: ImageParameterReads
      Effect: Allow
      Action:
        - ssm:GetParameter
        - ssm:GetParameters
      Resource: arn:aws:ssm:*:*:parameter/imagebuilder/*
```
